File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes \t size in java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "\t size in java" Watch "\t size in java" New topic

\t size in java

Lucky J Verma
Ranch Hand

Joined: Apr 11, 2007
Posts: 278
I am little confused about how much spaces are included in \t in Java and its coming different if i print in on console.

I have a input string = "abc\n\tdef";
and printing on console -System.out.println (inputString) gives me something like
def; (console printing shows bigger space for tabs)

I feed this inputString to a method ,that does some processing but wont harm tabs and returns the formatted string again.
That returned string has value
def (less tabs space)
Lesser tabs space.I debugged the method if at a point tab is changing but no .
Method just reads everything line by line and appends \r\n inplace of \n.

I really dont understand what could be the reason for different tabs size on same platform and same language.


Lucky J Verma
Ranch Hand

Joined: Apr 11, 2007
Posts: 278
Hey guys i got answer to my qn.Thanks.
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46353
And what was the answer?
I agree. Here's the link:
subject: \t size in java
jQuery in Action, 3rd edition