Operators

The syntax of the expressions is rather peculiar. All variables in stedi are in principle string variables. This means that they are stored as character strings and only when the need is there they may be interpreted as numbers or logical variables. The same variable may be interpreted differently, depending on the operations that are applied to it. Note that the value false corresponds either to the digit zero, or to a string with only blanks and/or tabs or to an empty string. All other strings result in the value true if their logical value is asked for. The operations are in the order in which they take precedence:

$!$
This is a unary operator. It precedes a logical object and makes it into its logical complement. A logical object is the character `1' for true or the character `0' for false. Any other string is first converted according to the rule that an empty string or strings that contain only blanks, tabs and/or zeroes represent the logical value false. All other strings represent true.
strlen
A unary operator giving the length of the string following it. It can be very handy when a string has to be processed character by character. For an example see the section on binary editing p. [*].
toupper
Converts the object after it to upper case, according to the built in tables. If the native display fonts contain alphabetic characters belonging to national character sets they may be changed too.
tolower
Converts the object after it to lower case, according to the built in tables. If the native display fonts contain alphabetic characters belonging to national character sets they may be changed too.
$*$
A numerical multiplication. The objects to the left and the right of this operator must be readable as a number or an error message will be printed and the execution will be halted.
$/$
A numerical division for numerical objects only. This command has the same precedence as $*$. The evaluation is strictly from left to right.
$\%$
The remainder after the division of the object left of the % sign by the object to the right of it.
$+$
For numerical objects this is the regular addition. If either one of the objects cannot be interpreted as a number it is a string concatenation. It can also be interpreted as a unary plus sign.
$-$
A regular subtraction for numerical objects only. It can also be interpreted as a unary minus sign.
$:>$
This operator needs as its left argument a string and as its right argument a number. It shortens the string from the left by the given number of characters. So only the right most characters are left. It is referred to as `string take right'.
$<:$
Again the first argument is a string and the second a number. Now the characters are taken away from the right. It is referred to as `string take left'.
$=\wedge$
The two arguments are interpreted as strings. The first string is scanned from the left to see whether it contains the second string. If so all the characters to the left of this occurrence and the occurrence itself are removed. So only the characters to the right of this match are left. It is called `string strip left'.
$\wedge^=$
Same as the operation before but now the matching is done from the right and only the leftmost characters are left. If there is no match the resulting string is identical to the first string. It is called `string strip right'.
$»$
The left argument is a string and the right argument should be a number. The leaves the rightmost indicated number of characters of the string. It is referred to as `string make right'.
$«$
The left argument is a string and the right argument should be a number. The leaves the leftmost indicated number of characters of the string. It is referred to as `string make left'.
$\widetilde{}$
This is a string concatenation. The result of this operation is a string take consists of the combination of the contents of its left and right arguments.
$//$
This is another notation for string concatenation.
$!=$
This is a logical operator. Its arguments are interpreted as strings and the result is either true when the objects are unequal and false when they are equal in a lexicographic sense.
$==$
The logical equal operator: result is true is the objects are equal as strings (in lexicographic sense).
$>$
If both the arguments are numeric the comparison is a numeric comparison. Otherwise the arguments are compared in a lexicographic sense. If the first is greater than the second the result is true.
$<$
If both the arguments are numeric the comparison is a numeric comparison. Otherwise the arguments are compared in a lexicographic sense. If the first is less than the second the result is true.
$>=$
If both the arguments are numeric the comparison is a numeric comparison. Otherwise the arguments are compared in a lexicographic sense. If the first is greater than or equal to the second the result is true.
$<=$
If both the arguments are numeric the comparison is a numeric comparison. Otherwise the arguments are compared in a lexicographic sense. If the first is less than or equal to the second the result is true.
$> $, $< $, $>= $, $<= $
Same as >, <, $>=$ and $<=$ but now the compare is forced to be lexicographic.
$\&\&$
This operator interprets its arguments as logical objects. If both are true the result is true. Otherwise the result is false. This is the `and' operation.
$\vert\vert$
This is the logical `if' operation. If either of the arguments is true the result is true.
It could be that in the future more operations are added to this list. It is allowed to use parentheses to group subexpressions. An expression may continue over more than one line. In that case the end of a line that is to be continued should be formed either by a backslash character or an <escape> character. On some systems the backslash cannot be used to `escape' the end of line, because this would interfere too much with the path name conventions of the local file system. In that case only the escape character may be used to `escape' the end of line. This escape character can be typed in with the sequence `ctrl-H escape' The above continuation may not occur in the middle of a name or between the characters that indicate an operation. Note that for numerical purposes the empty string is interpreted as zero. When the user needs to introduce a string there are two possibilities: In the first the string is enclosed between double quotes as in "string". The backslash or the <escape> characters can be used to `escape' characters like the double quote itself a dollar sign or a linefeed. In the second possibility the string starts with an alphabetic `word character' and runs till the first character that is not part of a word. Excluded from this possibility are all those words that are interpreted as operators, so it is best to always use the notation with the double quotes. Numbers may be entered as regular numbers. They are always interpreted as decimal numbers.