Node:Strings, Next:, Previous:Enumerations, Up:Sequences



Strings

A string is a sequence of characters.

String constants are written using double quotes:

"This is a string"

A dollar-sign ($) in a string constant prefixes an expression that should be evaluated. The result is converted to a string, and inserted in place:

:a="abc"
"XX$(a)YY" # Evaluates to "XXabcYY"

Special characters can be notated using \, as in C. There are a few useful extensions:

\^X - represents the control character Ctrl-X.

A newline following a \ means to skip the newline, and any following spaces or tabs. A space or tab following a \ means to skip all spaces and tabs, then, if the next character is a newline, skip the newline, and any following spaces and tabs.