You can use the integer data type to store and manipulate integer values. The range of values supported
is implementation defined: you should avoid writing programs that depend on a particular range. However, OmniMark
will always be able to handle integer values between -2,147,483,648 and 2,147,483,647.
Because any string expression can be used as a numeric value, saved pattern text, attribute
values, and even element content can be used as a numeric value, provided that the contents form a valid
number.
Numbers with a radix other than 10 must be expressed as a string expression, and can be converted to a
numeric expression using the operator base.
You can specify an integer with underscores: this allows digits to be grouped for readability. For example
process local integer x set x to 1_000_000
Integers are automatically initialized to 0.
You can initialize integer variables when you declare them:
global integer quantity initial { 5 }
You can set the value of an integer to the value of a numeric literal, another integer, the
result of an integer expression, or a string expression or literal string that evaluates
to an integer value:
process local integer quantity local integer number-of-things local integer number-of-children local integer apples-per-child local string form-data initial { "27" with key "quantity" } set quantity to 5 set quantity to number-of-things set quantity to number-of-children * apples-per-child set quantity to form-data{"quantity"} set quantity to "27"
You can use the following operators with integers:
+
-
*
/
modulo
increment
decrement
<
>
<=
>=
=
!=
%
mask
union
difference
complement
shift
See data type conversion for information on how to
convert from integer to other data types and vice versa.