Navigation: Language Reference > 13 - Built-in Functions >====== QUOTE (replace string special characters) ====== | |
QUOTE( string , flag)
QUOTE | Expands (or unpacks) string data |
string | A string constant or variable containing the properties to parse. |
flag | An unsigned integer that controls the method of unpacking. |
The way that QUOTE processes the string is based on the flag parameter.
If the flag parameter is set to 0 (default), the QUOTE procedure returns the string contained in the symbol with all single quotes ('), un-paired left angle brackets (<;), and un-paired left curly braces ({) “doubled up” to prevent compiler errors. Non-printable characters are replaced with <;n> sequences, where n is a character code. 10 or more repeated characters are replaced with a a{n} sequence, where a is a character and n is the number of times that the character is repeated.
If the flag parameter is set to 1, QUOTE unpacks {} and <;> sequences if the sequence inside the {} or <;> is numeric and doubles all single quotes (').
This allows the user to enter string constants containing apostrophes, and filter expressions containing less than signs (<;) without requiring that they enter two of each.
Return Data Type: STRING
Example:
stringvar1 STRING('<;250>')
stringvar2 STRING('<;display text>')
stringvar3 STRING(30)
CODE
MESSAGE(QUOTE(stringvar1,0)) !returns accented u
MESSAGE(QUOTE(stringvar1,1)) !returns accented u
MESSAGE(QUOTE(stringvar2,0)) !returns '<;<;display text>'
MESSAGE(QUOTE(stringvar2,1)) !returns '<;display text>'
stringvar3 = 'label{{PROP:text} = value'
MESSAGE(QUOTE(stringvar3,0)) !returns 'label{{PROP:text} = value'
MESSAGE(QUOTE(stringvar3,1)) !returns 'label{PROP:text} = value'
See Also: