Syntax:
|
SETMID
|
[ variable ] = [ value ] [ cnt ] [ at ]
|
Arguments:
|
[ variable ]
|
Variable to assign; if the variable does not previously exist it is created.
|
|
[ value ]
|
Variable or string defining the value from which the substring is to be extracted.
|
|
[ cnt ]
|
Variable, string, or numeric constant defining the length of the substring; this value must resolve to a numeric value less than or equal to the length of [ value ].
|
|
[ at ]
|
Variable, string, or numeric constant defining the position in [ value ] where the substring extraction is to begin; the first character in a string is at position 1.
|
Options:
|
none
|
|
This script command extracts [ cnt ] characters from within [ value ] beginning with character number [ at ] and saves the result in [ variable ].
Consider the following example.
;; assign a variable to a string
SET string = "this is a string"
;; extract 2 characters from mid-string starting at character #6
SETMID substring = string "2" "6"
The resulting substring variable contains the value "is".
Related Command(s): SET, SETRIGHT, SETLEFT
|