Description
Obtains a specified number of characters from the beginning of a string.
Syntax
Left ( string, n )
Argument |
Description |
---|---|
string |
The string containing the characters you want |
n |
A long specifying the number of characters you want |
Return value
String. Returns the leftmost n characters in string if it succeeds and the empty string ("") if an error occurs.
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 expression returns BABE:
Left("BABE RUTH", 4)
This expression returns BABE RUTH:
Left("BABE RUTH", 40)
This expression for a computed field returns the first 40 characters of the text in the column home_address:
Left(home_address, 40)
See also
Left in PowerScript Reference