Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

189
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!