Go to the first, previous, next, last section, table of contents.


Reversed Equate String Operators

The + operator and all the comparison operators also work on strings. The + operator concatenates two string argumennts 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 (which can be on the stack or taken from a variable) and a numeric index position. The result pushed is the numeric value of the character in the string at the index position. The index cannot 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      >>E>>S>>S1"">>S2\0>>X\
	[<<S<<E<=;<<S'S1\<<X`S2>>S2++S>>S++X>>X]\
	0<<X`S2

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.