The following table describes the supported string functions.
| Function | Description |
|---|---|
ASCII |
Returns the ASCII code value of the leftmost character in the string as an integer. |
BIT_LENGTH |
Returns the length of the string in bits. |
CHAR |
Returns the character corresponding to each integer passed. |
CHAR_LENGTH |
Returns the length of the string in characters. |
CONCAT |
Concatenates two or more strings into a single string. |
CONCAT_WS |
Concatenates two or more strings with a specified separator. |
ELT |
Returns the Nth element from a list. |
EXPORT_SET |
Returns a string representing a set of values. |
FIELD |
Returns the index position of the first occurrence of a value in a list. |
FIND_IN_SET |
Returns the position of a string within a comma-separated list. |
FROM_BASE64 |
Decodes a base64-encoded string and returns the decoded string. |
HEX |
Returns the hexadecimal representation of a string or number. |
INSERT |
Inserts a substring into a string at a specified position. |
INSTR |
Returns the position of the first occurrence of a substring within a string. |
LCASE |
Synonym for LOWER. |
LEFT |
Returns the leftmost n characters from a string. |
LENGTH |
Returns the length of the string in bytes. |
LOAD_FILE |
Reads a file and returns its contents as a string. |
LOCATE |
Returns the position of the first occurrence of a substring. |
LOWER |
Converts all characters in a string to lowercase. |
LPAD |
Pads the left side of a string with a specified character or spaces until the string reaches a specified length. |
LTRIM |
Removes leading spaces (spaces at the beginning of a string). |
MAKE_SET |
Returns the set members for a bit value. |
MID |
Synonym for SUBSTRING. |
OCT |
Returns the octal representation of a string or number. |
ORD |
Returns the numeric code of the leftmost character of the string. |
POSITION |
Returns the position of the first occurrence of a substring in a string. |
QUOTE |
Quotes a string for use in SQL queries. |
REGEXP_INSTR |
Returns the starting index of the substring that matches a regular expression pattern. |
REGEXP_REPLACE |
Replaces substrings that match a regular expression pattern with a replacement string. |
REGEXP_SUBSTR |
Returns the substring that matches the regular expression pattern. |
REPEAT |
Repeats a string n times and returns the resulting string. |
REPLACE |
Replaces occurrences of a substring with a new substring. |
REVERSE |
Reverses the characters in a string. |
RIGHT |
Returns the rightmost n characters from a string. |
RPAD |
Pads the right side of a string with a specified character or spaces until the string reaches a specified length. |
RTRIM |
Removes trailing spaces (spaces at the end of a string). |
SOUNDEX |
Returns the Soundex representation of a string, which is a phonetic representation used for string comparison. |
SPACE |
Returns a string consisting of n spaces. |
STRCMP |
Compares two strings and returns a result. |
SUBSTRING |
Extracts a substring from a string. |
SUBSTRING_INDEX |
Returns a substring before or after a specified delimiter in a string. |
TO_BASE64 |
Encodes a string into base64 format and returns the encoded string. |
TRIM |
Removes leading and trailing spaces (or other specified characters) from a string. |
UCASE |
Synonym for UPPER. |
UNHEX |
Converts a hexadecimal string to its binary representation. |
UPPER |
Converts all characters in a string to uppercase. |
For more information, see the MySQL documentation: String Functions and Operators.