The +
operator and all the comparison operators also work on strings.
The +
operator concatenates two string arguments together, whereas
the comparison operators will compare strings character by character. A
string is less than another if it is earlier in ascii dictionary order and is
greater than another if it is later in ascii dictionary order.
The index operators '
and `
are more complex. The '
takes two
arguments, a string to index and a numeric index position. The result is the
numeric value of the character in the string at the index position. The index
can not go beyond the end of the string. The `
operator is the reverse.
It takes three arguments, the additonal one being the numeric value to write
into the string at the given index position. Below is the definition of
substr
as an example of how these operators are used.
%%EQUATE substr(s1,s,e) "" >> s2 0 >> x while s <= e do s2,(s1's)`x >> s2 s + 1 >> s x + 1 >> x wend outputs(s2,0`x)
The function takes three arguments, the string to produce a substring of, the start index and end index for the string. It pushes the resultant substring.
Go to the first, previous, next, last section, table of contents.