About Character Literals

Search for answers or browse our knowledge base.

< All Topics

A character literal is any string of characters enclosed in quotation marks as shown in the following example:

‘This is a character string.’
“This is a character string, too.”

For convenience, you can enter character literals without the delimiting quotation marks; however, quotation marks are required in some situations. The rules for using quotation marks are described in Quotation Marks.

Valid and Invalid Literals

The following are examples of valid literals:

‘abc’Is a character string.
‘ab”C’Is a character string.
Is a null string.
3.14159Is a number literal.
9Is a number literal.
‘10.99’Is a character string.
‘John’s toy boat’Is a character string.
‘ABCd_EfG’Is a character string.
‘1234A’Is a character string.

The following are examples of invalid literals:

1 23Spaces are not permitted in number literals.
$10.99Periods are not permitted in an unquoted character string, and the dollar sign is not permitted in a number literal.
‘John’s toy boat’‘John’ is a valid character string, but the rest of the line is invalid.


Was this article helpful?
0 out of 5 stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.

Leave a Reply

Your email address will not be published. Required fields are marked *