|
These formula expressions can be used in
evaluate directives
and in an evaluate
condition in an if directive.
You can refer to form variables by name alone inside a
formula expression, provided the variable name starts with a
letter or the underscore ("_"), and contains only
letters, digits and the underscore. You can still refer
to other variables using the formatting escapes, provided the
substitution would result in valid syntax for the formula
expressions..
The common arithmetic operators (+, -, *, /) and comparison
operators (=, <>, !=, >, >=, <=) are available,
as well as the following:
| Operator | Usage | Description |
| \ | string \ n | take the leftmost
n characters from the string. |
| $ | string $ n | take the rightmost
n characters from the string. |
| \\ | string1 \\ string2 | take the
portion of string1 before the first occurrence of one of the
characters in string2. |
| $$ | string1 $$ string2 | take the
portion of string1 after the last occurrence of one of the
characters in string2. |
| // | string1 // string2 | return
the location of the first occurrence of one of the
characters in string2 found in string1. |
| ?? | string1 ?? string2 | return
the location of the last occurrence of one of the
characters in string2 found in string1. |
| $ | string $ n | take the rightmost
n characters from the string. |
| : | string1 : string2 |
take string1, with all characters in string2
trimmed from the right hand side. |
| # | string # string |
concatenate the strings. |
| ? | ?string | take the length of
the string. |
| | | integer | integer |
bitwise or. |
| & | integer & integer |
bitwise and. |
| ^ | integer ^ integer |
bitwise exclusive or. |
| ~ | ~integer |
bitwise not. |
| ! | !integer |
boolean not (0 becomes 1, everything else becomes 0).
|
Boolean expressions return 1 for true and 0 for false.
It is strongly recommended that you put spaces around operators -
future versions of dbCGI may include new operators formed by
using more than one operator character from the existing set of operator
characters.
Evaluation precedence is as follows, from highest to lowest:
-
Unary operators (~, !, ?)
-
Substring operators (\, $)
-
String Concatenation (#)
-
Multiplication and division (*, /)
-
Addition and subtraction (+, -)
-
Boolean comparison operators (=, <>, !=, >, >=,
<=)
-
Bitwise boolean operators (|, &, ^)
The order of evaluation can be overridden by using parenthises -
"(...)".
Literal strings can be inserted into expressions by enclosing them
in either single or double quote characters.
|