Extracts
a portion of a given string.
Syntax
Substr(
s1
,
n1
,
n2
)
Parameters
Parameter
|
Description
|
s1
|
The source string.
|
n1
|
The position in string
s1
to
start extracting.
If
n1 i
s less than one,
the function assumes the first character position. If
n1
is
greater than length of
s1
, the function assumes
the last character position.
|
n2
|
The number of characters to extract.
If
n2
is
less than or equal to 0, FormCalc returns an empty string. If
n1 + n2
is
greater than the length of
s1
, the function returns
the substring starting at position
n1
to the end
of
s1
.
|
Examples
The
following expressions are examples that use the
Substr
function:
Expression
|
Returns
|
Substr("ABCDEFG", 3, 4)
|
CDEF
|
Substr(3214, 2, 1)
|
2
|
Substr(Last_Name[0], 1, 3)
|
Returns the first three characters from
the first occurrence of
Last_Name
.
|
Substr("ABCDEFG", 5, 0)
|
""
|
Substr("21 Waterloo St.", 4, 5)
|
Water
|
|
|
|