Left PowerScript function
Description
Obtains a specified number of
characters from the beginning of a string.
Syntax
|
1 |
<span>Left</span> ( <span>string</span>, <span>n</span> <span></span>) |
|
Argument |
Description |
|---|---|
|
string |
The string you want to search |
|
n |
A long specifying the number of characters |
Return Values
String. Returns the leftmost n characters
in string if it succeeds and the empty string
(“”) if an error occurs. If any argument’s value is null, Left returns null.
If n is greater than or equal to the length
of the string, Left returns the entire string. It
does not add spaces to make the return value’s length equal
to n.
Examples
This statement returns BABE:
|
1 |
<span>Left</span>("BABE RUTH", 4) |
This statement returns BABE RUTH:
|
1 |
<span>Left</span>("BABE RUTH", 40) |
These statements store the first 40 characters of
the text in the SingleLineEdit sle_address in emp_address:
|
1 |
string emp_address |
|
1 |
emp_address = <span>Left</span>(sle_address.Text, 40) |
For sample code that uses Left to parse
two tab-separated values, see the Pos function.