Assign String Functions
Reference: Assign
The Assign command provides several functions for parsing strings. These functions are available only in this command. The operand must be a quoted string. The various length and offset operators may be numbers or strings. Numeric offsets are zero-relative. String operators search the operand from the left, selecting the first occurrence of the target. Comparisons are not case-sensitive. Variables may be used for both operators and operands. However, quotes are still required to identify strings.
• Left -
returns the leading characters of the string, including any string target:
:Assign: f = Left 5 “Bingo was his
nameo” results in “Bingo”
:Assign: f =
Left “was” “Bingo was his nameo” results in “Bingo was”
• LeftX -
returns the leading characters of the string, excluding any string target (note
the leading space in the target):
:Assign: f = Left “ was” “Bingo was
his nameo” results in “Bingo”
• Mid - returns
the sub-string starting at the offset for the specified length, or the
sub-string between the target strings, including the target strings:
:Assign: f = Mid 6 7 “Bingo was his
nameo” results in was his
:Assign: f =
Mid “w” “me” “Bingo was his nameo” results in “was his name”
• MidX -
returns the sub-string excluding the target strings:
:Assign: f = MidX “w” “me” “Bingo was
his nameo” results in “as his na”
• Right -
returns the trailing characters of the string, including any target
strings.
:Assign: f = Right 5
“Bingo was his nameo” results in
“nameo”
:Assign: f = Right “was” “Bingo was
his nameo” results in “was his nameo”
• RightX -
returns the trailing characters of the string, excluding an target strings (note
the trailing space in the target).
:Assign: f = RightX “was ” “Bingo was
his nameo” results in “his nameo”
• Length -
returns the count of characters in the
string.
:Assign: c = Length “Bingo was
his nameo” results in 19.
The output of the Length function is numeric. All other functions return a string.