Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

191
Vistas
Writing columns into a text file

Before tagging my question as a duplicate question, please let me explain first!

I know using String.format will let the text to be written into two columns, but that is not what I need. Because using String.format just gives specified number of spaces between any two desirable strings. What I am looking is that if in the text file, we press tab key in Windows based systems, it jumps directly to the next column, or in other words, if we copy the content of the text file and paste it into some software like Excel, SPSS etc, it automatically pastes each column from text file into a separate column in the corresponding software. Here is my current code which does not satisfy my need:

String formatStr = "%20s %20s";
String query="some string";
int value="some int";
fop.write(String.format(formatStr,query,value));
fop.write(System.getProperty("line.separator"));
fop.flush();
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You want tab separated values:

String.format("%s\t%s", query, value);

\t is the escape code for the "tab" character.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda