SETLEFT Extract left substring |
Top Previous Next |
This script command extracts the leftmost [ cnt ] characters from [ value ] and saves the result in [ variable ].
If the /split option is specified, the unextracted portion of [ variable ] is assigned back to [ variable ] replacing the original value.
Consider the following example.
;; assign a variable to a string SET string = "this is a string" ;; extract the leftmost 4 characters SETLEFT substring = string "4"
The resulting substring variable contains the value "this". The original string variable is unchanged.
Consider the same example using the /split option.
;; assign a variable to a string SET string = "this is a string" ;; extract the leftmost 4 characters SETLEFT substring = string "4" /split
The resulting substring variable contains the value "this" and the original string variable has be reassigned to " is a string".
Related Command(s): SET, SETRIGHT, SETMID
|