- Strings are constants. You cannot add to, delete from, or change the characters
in strings.
- If you want to determine the length of a string, then instantiate the
following pattern:
string.length()
- If you want to extract a character from a string, then instantiate the
following pattern:
string.charAt(index)
- If you want to concatenate two strings, to create a new string, then
instantiate the following pattern:
first string + second string
- If you want to denote a character, then surround that character with
single quotation marks.
- If you want a tokenizer to return a token for the end of a line, then
instantiate the following pattern:
token variable.eolIsSignificant(true);
- If you want to know whether the current token represents the end of a line,
then compare the value produced by
nextToken
to the
TT_EOL
instance variable:
nextToken's value == token variable.TT_EOL
- If you want a tokenizer to use the double quotation mark to delimit
strings with embedded spaces, then instantiate the following pattern:
token variable.quoteChar((int) '"');