Left function
Syntax
Left(source_str, num_chars)
Description
Use the Left function to return a substring containing the leftmost number of characters in source_str. num_chars specifies how many characters to extract. If the string contains Unicode non-BMP characters, each code unit of the surrogate pair is counted as a separate character and care should be taken not to split the surrogate pair.
Parameters
| Parameter | Description |
|---|---|
|
source_str |
A String from which to derive the substring. |
|
num_chars |
A Number specifying how many characters to take from the left of source_str. The value of num_chars must be greater than or equal to zero. If num_chars is greater than the length of source_str, Left returns the entire string. If num_chars is omitted, it is assumed to be one. |
Returns
Returns a String value derived from source_str.
Example
The following example sets &SHORT_ZIP to "90210":
&SHORT_ZIP = Left("90210-4455", 5);
Related Topics