String expressions

The most basic string expression is any number of characters contained in double quotes ("for instance"). As in C the escape character is \ and there is a number of commands you can use within a string:

Escape characters:
Character sequence Meaning Notes
\\ Backslash
\" Double-quote
\{ Curly bracket left
\} Curly bracket right
\n Newline ($0A)
\t Tab ($09)
\1-\9 Macroargument Only in macros
\@ Labelname suffix Only in macros and repts

A funky feature is {symbol} withing a string. This will examine the type of the symbol and insert its value accordingly. If symbol is a string symbol the symbols value is simply copied. If it's a numeric symbol the value is converted to hexadecimal notation and inserted as a string.

HINT: The {symbol} construct can also be used outside strings. The symbols value is again inserted as a string. This is just a short way of doing "{symbol}".
Whenever the macro-language expects a string you can actually use a string expression. This consists of one or more of these function. Yes, you can nest them. Note that some of these functions actually return an integer and can be used as part of an integer expression!

String functions:
Name Operation
STRLEN(stringexpr) Returns the number of characters in string
STRCAT(stringexpr1,stringexpr2) Appends stringexpr2 to stringexpr1.
STRCMP(stringexpr1,stringexpr2) Returns negative if stringexpr1 is alphabetically less than stringexpr2
Zero if they match
Positive if greater than
STRIN(haystack,needle) Returns needles position within haystack or zero if it's not present
STRSUB(stringexpr,pos,count) Returns a substring of stringexpr starting at pos (first character is position 1) and with count characters
STRUPR(stringexpr) Converts all characters in string to capitals and returns the new string
STRLWR(string) Converts all characters in string to lower case and returns the new string

See also:

Last updated 21 June 1997 by Carsten Sorensen