String Functions
The following lists string functions:
Name | Description |
---|---|
CONCAT() | Concatenate arguments into one CHAR string |
FORMAT() | Convert FLOAT or DOUBLE to CHAR string with specified precision |
HEX() | Convert value into hexadecimal representation |
LEFT() | Return the specified leftmost number of characters in a string |
LENGTH() | Return string length |
LOCATE() | Return the position of a substring within another string |
LOWER() | Convert all letters in the specified string to lowercase |
LPAD() | Return a CHAR string left-padded with specified string |
LTRIM() | Remove leading spaces |
RIGHT() | Return the specified rightmost number of characters in a string |
RPAD() | Return a CHAR string right-padded with specified string |
RTRIM() | Remove trailing spaces from a string |
SUBSTR() | Return a CHAR substring as specified |
SUBSTRING() | Same as SUBSTR() |
UPPER() | Convert all letters in the specified string to uppercase |
CONCAT
concat(string1, string2, ...)
The CONCAT function concatenates multiple string arguments into one CHAR string.
FORMAT
format(number, precision)
The FORMAT function converts a number to a CHAR string with specified precision.
HEX
hex(value)
The HEX function converts a number or string to hexadecimal representation.
LEFT
left(string, n)
The LEFT function returns the leftmost n characters in string.
LENGTH
length(string)
The LENGTH function returns the length of the given string.
--
LOCATE
locate(string1, string2, [start_pos])
The LOCATE function returns the position of the first occurrence of string1 in string2 starting at position start_pos. It returns 0 if string1 is not in string2. If start_pos is not given, it is assumed to be 1.
LPAD
lpad(string, len, padstring)
The LPAD function left pads string with padstring to a CHAR string with length len.
RIGHT
right(string, n)
The RIGHT function returns the rightmost n characters in string.
RPAD
rpad(string, len, padstring)
The RPAD function right pads string with padstring to a CHAR string with length len.
SUBSTR
substr(string, pos, len)
The SUBSTR function returns a CHAR string with length len starting from position pos of string.