C.2.4. String Functions
Most of the functions in this section return a string result. Some of them, such as LENGTH()
, take strings as arguments and return a number. For functions that operate on strings based on string positions, the position of the first (leftmost) character is 1, not 0.
Several string functions are multi-byte safe: CHAR_LENGTH()
, INSERT()
, INSTR()
, LCASE()
, LEFT()
, LOCATE()
, LOWER()
, LTRIM()
, MID()
, POSITION()
, REPLACE()
, REVERSE()
, RIGHT()
, RPAD()
, RTRIM()
, SUBSTRING()
, SUBSTRING_INDEX()
, TRIM()
, UCASE()
, and UPPER()
.
• ASCII(str)
Returns the integer value of the leftmost byte of the string str, in the range from 0 to 255. It returns 0 if str is empty or NULL
if str is NULL
. str should contain only 8-bit characters.
Get MySQL, 5th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.