TAB in Java

TAB unicode? for java

Page 1 of 1

7 Replies - 55087 Views - Last Post: 18 December 2008 - 08:44 PM Rate Topic: -----

#1 TheLastPro  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 16
  • Joined: 16-December 08

TAB in Java

Post icon  Posted 18 December 2008 - 08:13 PM

how can i insert a tab character in java... and not just a few spaces as in when you press the tab key in compilers, but an actual char that can be compared with a tab from a txt file. how would i make a char/string with this character?

EDIT: the /t isnt rly working when i try to create a char.

This post has been edited by TheLastPro: 18 December 2008 - 08:18 PM

Is This A Good Question/Topic? 0
  • +

Replies To: TAB in Java

#2 Locke  Icon User is offline

  • Sarcasm Extraordinaire!
  • member icon

Reputation: 520
  • View blog
  • Posts: 5,596
  • Joined: 20-March 08

Re: TAB in Java

Posted 18 December 2008 - 08:18 PM

Reverse the slash...

\t

That should work a little better. :)
Was This Post Helpful? 0
  • +
  • -

#3 cfoley  Icon User is offline

  • Cabbage
  • member icon

Reputation: 1937
  • View blog
  • Posts: 4,022
  • Joined: 11-December 07

Re: TAB in Java

Posted 18 December 2008 - 08:19 PM

\t is the way to go. Steer clear of unicode references, especially whitespace ones. They are parsed before the java file is compiled.
Was This Post Helpful? 0
  • +
  • -

#4 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8324
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: TAB in Java

Posted 18 December 2008 - 08:20 PM

View PostTheLastPro, on 18 Dec, 2008 - 07:13 PM, said:

how can i insert a tab character in java... and not just a few spaces as in when you press the tab key in compilers, but an actual char that can be compared with a tab from a txt file. how would i make a char/string with this character?

EDIT: the /t isnt rly working when i try to create a char.

it is not /t it is \t

String str ="hello\tworld"; is "Hello<TAB>word"
Was This Post Helpful? 0
  • +
  • -

#5 TheLastPro  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 16
  • Joined: 16-December 08

Re: TAB in Java

Posted 18 December 2008 - 08:22 PM

i dont know if u guyz will believe this, but i was just getting on this site to post that i did the rong slash right now xD. sry lol :blink: :blink: :blink:
Was This Post Helpful? 0
  • +
  • -

#6 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8324
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: TAB in Java

Posted 18 December 2008 - 08:22 PM

3 answers in 3 minutes
3 equivalent answers... they must be right
Locke and Cfoley seems the forum is quiet tonight
Was This Post Helpful? 0
  • +
  • -

#7 Locke  Icon User is offline

  • Sarcasm Extraordinaire!
  • member icon

Reputation: 520
  • View blog
  • Posts: 5,596
  • Joined: 20-March 08

Re: TAB in Java

Posted 18 December 2008 - 08:24 PM

Yeah, pretty much. I should be writing my English paper that's due tomorrow though...
Was This Post Helpful? 0
  • +
  • -

#8 TheLastPro  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 16
  • Joined: 16-December 08

Re: TAB in Java

Posted 18 December 2008 - 08:44 PM

i happen to be writing stuff for english right now lol
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1