String Functions

Functions dealing with strings, such as CHAR, CONVERT, CONCAT, PAD, REGEXP, TRIM, etc.

Title Description
Regular Expressions Functions Functions for dealing with regular expressions
Dynamic Columns Functions Functions for storing key/value pairs of data within a column.
ASCII Numeric ASCII value of leftmost character.
BIN Returns binary value.
BINARY Operator Casts to a binary string.
BIT_LENGTH Returns the length of a string in bits.
CAST Casts a value of one type to another type.
CHAR Function Returns string based on the integer values for the individual characters.
CHARACTER_LENGTH Synonym for CHAR_LENGTH().
CHAR_LENGTH Length of the string in characters.
CHR Returns string based on integer values of the individual characters.
CONCAT Returns concatenated string.
CONCAT_WS Concatenate with separator.
CONVERT Convert a value from one type to another type.
ELT Returns the N'th element from a set of strings.
EXPORT_SET Returns an on string for every bit set, an off string for every bit not set.
EXTRACTVALUE Returns the text of the first text node matched by the XPath expression.
FIELD Returns the index position of a string in a list.
FIND_IN_SET Returns the position of a string in a set of strings.
FORMAT Formats a number.
FROM_BASE64 Given a base-64 encoded string, returns the decoded result as a binary string.
HEX Returns hexadecimal value.
INSERT Function Replaces a part of a string with another string.
INSTR Returns the position of a string within a string.
LCASE Synonym for LOWER().
LEFT Returns the leftmost characters from a string.
LENGTH Length of the string in bytes.
LENGTHB Length of the given string, in bytes.
LIKE Whether expression matches a pattern.
LOAD_FILE Returns file contents as a string.
LOCATE Returns the position of a substring in a string.
LOWER Returns a string with all characters changed to lowercase.
LPAD Returns the string left-padded with another string to a given length.
LTRIM Returns the string with leading space characters removed.
MAKE_SET Make a set of strings that matches a bitmask.
MATCH AGAINST Perform a fulltext search on a fulltext index.
Full-Text Index Stopwords Default list of full-text stopwords used by MATCH...AGAINST.
MID Synonym for SUBSTRING(str,pos,len).
NATURAL_SORT_KEY Sorting that is closer to natural human sorting.
NOT LIKE Same as NOT(expr LIKE pat [ESCAPE 'escape_char']).
NOT REGEXP Same as NOT (expr REGEXP pat).
OCTET_LENGTH Returns the length of the given string, in bytes.
ORD Return ASCII or character code.
POSITION Returns the position of a substring in a string.
QUOTE Returns quoted, properly escaped string.
REPEAT Function Returns a string repeated a number of times.
REPLACE Function Replace occurrences of a string.
REVERSE Reverses the order of a string.
RIGHT Returns the rightmost N characters from a string.
RPAD Returns the string right-padded with another string to a given length.
RTRIM Returns the string with trailing space characters removed.
SOUNDEX Returns a string based on how the string sounds.
SOUNDS LIKE SOUNDEX(expr1) = SOUNDEX(expr2).
SPACE Returns a string of space characters.
STRCMP Compares two strings in sort order.
SUBSTR Returns a substring from string starting at a given position.
SUBSTRING Returns a substring from string starting at a given position.
SUBSTRING_INDEX Returns the substring from string before count occurrences of a delimiter.
TO_BASE64 Converts a string to its base-64 encoded form.
TO_CHAR Converts a date/time/timestamp type expression to a string.
TRIM Returns a string with all given prefixes or suffixes removed.
TRIM_ORACLE Synonym for the Oracle mode version of TRIM().
UCASE Synonym for UPPER().
UNCOMPRESSED_LENGTH Returns length of a string before being compressed with COMPRESS().
UNHEX Interprets pairs of hex digits as numbers and converts to the character represented by the number.
UPDATEXML Replace XML.
UPPER Changes string to uppercase.
WEIGHT_STRING Weight of the input string.
Type Conversion When implicit type conversion takes place.
SFORMAT Given a string and a formatting specification, returns a formatted string.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.

© 2021 MariaDB
Licensed under the Creative Commons Attribution 3.0 Unported License and the GNU Free Documentation License.
https://mariadb.com/kb/en/string-functions/