STRING CONSTANTS

A string constant is any sequence of characters that occurs between two matching string delimiters.

String constant delimiters are the double (") and single (') quote characters (the single quote character is also known as the apostrophy character).

If a string constant begins with a double quote (") character, then everything upto the next matching double quote character will be part of that string.

If a string constant begins with a single quote (') character, then everything upto the next matching single quote character will be part of that string.

This meens that a string constant that is delimited by single quotes can contain any number of double quotes and a string that is delimited by double quotes can contain any number of single quotes.

The following valid string constants are shown in BLUE and the invalid string constants are shown in RED

"this is a string constant"
'this is another string constant'

"this is an invalid string constant because the start and end quotes do not match'

"this is an invalid string constant because there is no matching end quote

"he said 'you should'"
'she said "you should not"'

"I'll see you soon"

'I'll phone later'