Name

q — Quote a literal string to prevent interpretation of special characters

Syntax

q(delimiterstringdatadelimiter)
              

The Q function has the following arguments:

delimiter

A single character that is used to delimit the raw string. Any character that is not within the content to be quoted may be used.

stringdata

The content of the raw string, including special characters.

Description

This function will capture all of the content within the delimiter characters without any interpretation of special characters. This simplifies the definitions of literal string containing quote characters or escaped regular expression characters.

The first non-space character encountered within the parenthesis is used as the delimiter character and will not be included in the raw string literal. All following characters are read and included in the raw string literal, up until the next encounter of the delimiter character. The closing delimiter is also discarded. The character after the closing delimiter must be the closing parenthesis of the q function.

The q function may be nested inside of other q functions, so long as different delimiter characters are used and the delimiter character for the outer function is not found within the inner function.

Examples

Formula

Description

Result

q(^I'm is a string^)

Capture everything within the pair of ^ delimiters without interpretation

'I\'m a string'

q(+OLDMIN ne ''+)

Capture the

'OLDMIN=\'\''
eval(q(|eval(q('1'))|))

Evaluate the string literal '1' within the inner function, and re-evaluate this to an integer value in the outer function

1