• Post Reply Bookmark Topic Watch Topic
  • New Topic

tab vs. excape sequence "\t" in String interal  RSS feed

 
Yu Chen
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From my testing, a tab in a String literal will lost the tab formatting and is interpreted as several spaces. While a "\t" will perserve the correct format. Can anyone help explain this?
(Is the tab or any other white spaces operation system or compiler dependent? In other words, I need to explicitly use escape sequences like "\t" or "\n" instead of just "manual" input them from my keyboard?)
Thanks!
-yu chen
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you should check your editor settings. Many editors can be configured to replace tabs by spaces when typing (or sometimes when saving).
 
Yu Chen
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you mean Java treat a tab input exactly the same as "\t" in a string leteral?
Thanks,
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!