String Literals
A string literal consists of zero or more characters
enclosed in double quotes. For backward compatibility with the original release
of Cisco Unified CCX software, we must maintain the first string literal format
which did not have any support for escape sequence. As such, string literals
since Cisco CRS 3.0 can be represented in two ways. The first one using one
pair of double quotes characters has no support for escape sequence so the \
character can be used to represent itself. The second format introduced in
Cisco CRS 3.0 uses two double quote characters where the first one is
represented by the lowercase letter u
where each character may be represented by an escape sequence.
A string literal is always of type String. A string literal always refers to the same instance of class String.
StringLiteral:
" NoEscapeStringCharactersopt "
u " StringCharactersopt "
NoEscapeStringCharacters:
NoEscapeStringCharacter
NoEscapeStringCharacters NoEscapeStringCharacter
NoEscapeStringCharacter:
InputCharacter but not "
StringCharacters:
StringCharacter
StringCharacters StringCharacter
StringCharacter:
UnicodeInputCharacter but not " or \
EscapeSequence
The escape sequences are described in Escape Sequences for Character and String Literals.
Neither of the characters CR and LF is ever considered to be an InputCharacter; each is recognized as constituting a LineTerminator.
You will receive a parse-time error if a line terminator appears after the opening " and before the closing matching ". A long string literal can always be broken up into shorter pieces and written as a (possibly parenthesized) expression using the string concatenation operator +.
Example string literals:
"" // the empty string
"\" // a string containing the \ character alone
u"\"" // a string containing " alone
"This is a string"// a string containing 16 characters
"This is a " +// a string-valued constant expression,
"two-line string"// formed from two string literals
Each string literal is a reference to an instance of class String. String objects have a constant value.