Description:
Get a substring starting from the leftmost side of a string.
Syntax:
left(s,n)
Note:
The function gets a substring from source string s starting from the first character at the leftmost side to the nth character. If n<0, get a substring starting from the first character at the leftmost side to the abs(n)th-to-last character.
Parameter:
s |
The source string |
n |
The nth character of source string s; return an empty string when the absolute value of n is greater than the length of s |
Return value:
A string
Example:
left("abcdefg",3) |
"abc". |
left("abcdefg",-3) |
"abcde". |
left("abcdefg",-10) |
Return an empty string. |
Related functions: