Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

\t size in java

 
Lucky J Verma
Ranch Hand
Posts: 278
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
abc
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
abc
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.

Thanks





 
Lucky J Verma
Ranch Hand
Posts: 278
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys i got answer to my qn.Thanks.
 
Campbell Ritchie
Sheriff
Posts: 48910
58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And what was the answer?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic