[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ] Character Strings

String is an arbitrary string of characters. Any input token consisting of letters of Latin alphabet, decimal digits, underscores dashes and dots and starting with a Latin alphabet letter or underscores is considered a string. To input strings containing other letters, surround them by double quotes. The following are valid strings:

"String, containing white space"

The double quote character ‘"’ must be preceeded by a backslash ‘\’ if it is part of a string:

"Always quote \" character"

Generally speaking, ‘\’ is an escape character, that alters the meaning of the immediately following character. If it is located at the end of the line, it allows to input newline character to strings:

"This string contains a \
newline character."

Other special escape sequences are:


Audible bell character (ASCII 7)


Backspace (ASCII 8)


Escape character (ASCII 27)


Form feed (ASCII 12)


Newline (ASCII 10)


Carriage return (ASCII 13)


Horizontal tab (ASCII 9)




(‘o’ represents an octal digit) A character whose ASCII value is represented by the octal number ‘ooo’.


(‘H’ represents a hex digit) A character whose ASCII value is represented by the hex number ‘HH’.

If the character following the backslash is not one of those specified, the backslash is ignored.

An important variant of string is a numeric string, or STRNUM for short. A numeric string is a string that can be converted to a number, for example "+2". This concept is used for type conversion between integer and string values.

Another way to represent strings is using here document syntax. Its format is as follows:


Delimiter is any word you choose to delimit the text, text represent the text of the string. If delimiter is prepended by a dash, any leading tabulation characters will be removed from text. This allows for natural indentation of ‘here document’ constructs.

The ‘here document’ construct is especially useful to represent strings containing embedded newlines, as shown in the example below:

print <<EOT
usage: foo [OPTIONS] [NAME...]
  -h            Print this help list.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated by Sergey Poznyakoff on December, 6 2008 using texi2html 1.78.