Glindra
Documentation Index Download
Command Line File Handling and ASCII Tools

Quoted String Syntax

Strings In Parameter Files

Strings may be enclosed in either single or double quotes.
Example
'Hello!'
"Hello!"
In parameter files read by Glindra programs, there is no difference in meaning between single quoted and double quoted strings, but the syntax for handling special characters and embedded quotes is different between the two.

Single Quoted Strings

The following escape sequences are recognized within single quoted strings:

\\ Backslash
\' Single quote character
\" Double quote character. This escape sequence is strictly speaking redundant, since double quotes have no special meaning within single quoted strings. It has been included for compatibility because it exists in other environments, such as the C++ language.
\? Question mark. Also redundant, as ? has no special meaning.
\a Alert (bell)
\f Form feed
\n New line
\r Carriage return
\t Horizontal tab
\v Vertical tab
\nnn The character with the octal ASCII value nnn, where the sequence nnn represents 1 to 3 octal digits.
\xnn The character with the hexadecimal ASCII value nn, where the sequence nn represents exactly 2 hexadecimal digits


No other backslash escape sequences than these are allowed, so a backslash that is followed by a character that is not among those listed above will generate a syntax error.

Example

The quoted string

'It\'s "almost" called PL\\1'
yields
It's "almost" called PL\1
when the quotes are removed.

Double Quoted Strings

To include a " character in a string surrounded by " quotes, the quote character is duplicated.

All other printing characters are just written as they are, and treated as literals. This includes the backslash character "\", which has no special significance inside double quoted strings.

Example
"It's ""almost"" called PL\1"
yields
It's "almost" called PL\1


Since the backslash character is just an ordinary literal character, there is no way of specifying non-printing control characters in a double quoted string. If you need to do that, you'll have to use single quotes instead, and adhere to that syntax.

Otherwise, it's a matter of personal preference which kind of quotes to use. For strings that contain backslashes, such as regular expressions or Windows path names, you may find the double quotes more convenient.