n0pe n0pe - 1 year ago 89
Java Question

Handling the TAB character in Java

I'm going through a configuration file with a RandomAccessFile reader. I have a configuration option which is one (1) tab away from the start of the line. When my reader gets this line, would I be able to just tell it to skip one character and then start reading, or does the tab character not work that way?


This is a line
This line has a tab

Let's say I've loaded the second line into my reader. If I'm playing with that String and I do
currentLine = currentLine.subString(1);

Would that give me:

currentLine = "This line has a tab";

Thanks for your help.

Answer Source

Yes the tab character is one character. You can match it in java with "\t".

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download