Forums Register Login

tab

+Pie Number of slices to send: Send
If I am parsing a line of text and I want to look for some character like the letter b, I would use some command like this:

if (myString.charAt(ind) == 'b'){
doSomething();
}

So, if I am looking for a tab instead of a regular character, what command should I use?
+Pie Number of slices to send: Send
Hi Kevin,

I havn't tested the following.. but it should work

You need something like:

if (myChar == *tab*) do something



You need to find the value for *tab*. I'll give you two hints (both which
should work):

1. Ever heard of escape characters? such as "\n"

2. Each char you might type has an (ascii) value that the computer understands.


/Svend Rost

More hints in the following.. but give it a try yourself before you look...








ad 1: Try to print the following: "My name \n is Kevin. I \t like Java"
ad 2: Look at the Ascii Table and try to search for the horizontal tab (HT).
+Pie Number of slices to send: Send
You could use something like this:



If you don't now where the tab resides in you string use:

knowledge is the difference between drudgery and strategic action -- tiny ad
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 440 times.
Similar Threads
Tab character question
Help with indentation
unable to remove spaces between buttons(making a calculator)
jbuilder automatic indent
a simple question
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 09:32:07.