This week's book giveaways are in the iOS and Features new in Java 8 forums. We're giving away four copies each of Barcodes with iOS: Bringing together the digital and physical worlds and Core Java for the Impatient and have the authors on-line! See this thread and this one for details.
How can i create a file with tab delimited characters? for example: I have String1, String2, String3, String4 and i have to create a file like this. string1 tab string2 tab string 3 tab string4 carriagereturn how can i create the file like this. To be more specific i am reading 6 columns from a table and creating a file with tab delimition between the values and carriage return for each row. How can i achieve this??? I tried using like this String tab = " "; bufferWriter.write (string1+tab+string2+tab+string3+tab+string4) bufferWriter.newLine(); -----> for carriage return. The file should be in UTF8. I searched in the net but could not able to find any related topics... Thanks in advance for your help kiran
A tab character (ASCII 9) should be interperted by whatever text viewer you are using as moving the following text to begin at the next "tab stop;" on old typewriters, a tab stop was located every five spaces; I think that modern text editors tend to use four spaces (of course, MS Word or the like has adjustable tab stops in the top ruler). So, when you use a tab, your spacing will come out uneven between words, but the columns should (pretty much) line up:
note that "this" and "of" line up, "is" and "the" line up, etc. This will not always be the case, however. Sometimes the length of the words can affect how things line up. This makes it tough for a human to read, but it makes no difference to a program (like Excel) that is trying to read the tab-delimited file:
Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
Originally posted by Joel McNary: on old typewriters, a tab stop was located every five spaces; I think that modern text editors tend to use four spaces (of course, MS Word or the like has adjustable tab stops in the top ruler).
Of course it was eight spaces and therefore serious editors use 8 spaces. Lamers use 4 or 3 spaces and even 2 spaces have been seen. Why making use of tabs at all? The biggest bullshit in this area is, to convert tabs to spaces.
I use tab delimited files all the time because I can copy and paste into Excel. Of course that requires a real man's text editor that can edit a file with tab expansion turned OFF so x'09' tab characters get copied into the clipboard! Nothing munges text like Kedit!
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
\t does not ensure certain 8 spaces between consecutive words. It just starts the next word at NEXT TAB POSITION. Next Tab Position = Next (1 + (8*n))th character position from current character position.