# String Functions

- [ASCII](https://mariadb.com/docs/server/reference/sql-functions/string-functions/ascii.md): Return the ASCII value of the first character. This function returns the numeric ASCII code for the leftmost character of the input string.
- [BIN](https://mariadb.com/docs/server/reference/sql-functions/string-functions/bin.md): Return the binary representation of a number. This function converts a number to its binary string equivalent.
- [BINARY Operator](https://mariadb.com/docs/server/reference/sql-functions/string-functions/binary-operator.md): Cast a string to a binary string. This operator converts a character string to a binary string, often used for case-sensitive comparisons.
- [BIT\_LENGTH](https://mariadb.com/docs/server/reference/sql-functions/string-functions/bit_length.md): Return the length of a string in bits. This function calculates the size of the string in bits (length in bytes multiplied by 8).
- [CAST](https://mariadb.com/docs/server/reference/sql-functions/string-functions/cast.md): Complete CAST reference for MariaDB. Complete function guide with syntax, parameters, return values, and usage examples with comprehensive examples and best.
- [CHAR Function](https://mariadb.com/docs/server/reference/sql-functions/string-functions/char-function.md): Return the character for each integer passed. This function interprets arguments as integer ASCII values and returns a string of those characters.
- [CHAR\_LENGTH](https://mariadb.com/docs/server/reference/sql-functions/string-functions/char_length.md): Return the length of a string in characters. This function counts the number of characters in the string, treating multi-byte characters as single units.
- [CHARACTER\_LENGTH](https://mariadb.com/docs/server/reference/sql-functions/string-functions/character_length.md): Synonym for CHAR\_LENGTH(). Returns the number of characters in the string.
- [CHR](https://mariadb.com/docs/server/reference/sql-functions/string-functions/chr.md): Return the character for a specific ASCII value. This function is similar to CHAR() but accepts a single integer argument.
- [CONCAT](https://mariadb.com/docs/server/reference/sql-functions/string-functions/concat.md): Complete CONCAT reference for MariaDB. Complete function guide with syntax, parameters, return values, and usage examples with comprehensive examples and.
- [CONCAT\_WS](https://mariadb.com/docs/server/reference/sql-functions/string-functions/concat_ws.md): Concatenate with separator. This function joins strings with a specified separator. It skips NULL values during concatenation.
- [CONVERT](https://mariadb.com/docs/server/reference/sql-functions/string-functions/convert.md): Complete CONVERT() reference: CONVERT(expr,type) and CONVERT(expr USING charset) syntax, SIGNED/UNSIGNED/BINARY/CHAR types, and CAST() differences.
- [ELT](https://mariadb.com/docs/server/reference/sql-functions/string-functions/elt.md): Return the string at a specific index. This function returns the N-th string from a list of arguments.
- [EXPORT\_SET](https://mariadb.com/docs/server/reference/sql-functions/string-functions/export_set.md): Return a string representation of bits. This function generates a string based on the bits set in a number, using specified 'on' and 'off' strings.
- [EXTRACTVALUE](https://mariadb.com/docs/server/reference/sql-functions/string-functions/extractvalue.md): Extract a value from XML. This function returns the text content of an XML fragment matching a given XPath expression.
- [FIELD](https://mariadb.com/docs/server/reference/sql-functions/string-functions/field.md): Return the index of a string in a list. This function returns the position of the first argument within the subsequent list of arguments.
- [FIND\_IN\_SET](https://mariadb.com/docs/server/reference/sql-functions/string-functions/find_in_set.md): Return the index of a string in a comma-separated list. This function finds the position of a string within a list of strings separated by commas.
- [FORMAT](https://mariadb.com/docs/server/reference/sql-functions/string-functions/format.md): Format a number. This function formats a number to a format like '#,###,###.##', rounded to a specified number of decimal places.
- [FROM\_BASE64](https://mariadb.com/docs/server/reference/sql-functions/string-functions/from_base64.md): Decode a base-64 encoded string. This function takes a base-64 string and returns the decoded binary result.
- [HEX](https://mariadb.com/docs/server/reference/sql-functions/string-functions/hex.md): Return the hexadecimal representation. This function converts a number or string to its hexadecimal string equivalent.
- [INSERT Function](https://mariadb.com/docs/server/reference/sql-functions/string-functions/insert-function.md): Insert a substring into a string. This function inserts a string within another string at a specified position and length, replacing existing characters.
- [INSTR](https://mariadb.com/docs/server/reference/sql-functions/string-functions/instr.md): Return the position of the first occurrence of a substring. This function locates a substring within a string and returns its index.
- [LCASE](https://mariadb.com/docs/server/reference/sql-functions/string-functions/lcase.md): Synonym for LOWER(). Converts a string to lowercase characters.
- [LEFT](https://mariadb.com/docs/server/reference/sql-functions/string-functions/left.md): Return the leftmost characters. This function returns the specified number of characters from the beginning (left) of a string.
- [LENGTH](https://mariadb.com/docs/server/reference/sql-functions/string-functions/length.md): Return the length of a string in bytes. This function counts the number of bytes in the string, which may differ from character count for multi-byte strings.
- [LENGTHB](https://mariadb.com/docs/server/reference/sql-functions/string-functions/lengthb.md): Return the length of a string in bytes. This function is a synonym for LENGTH() in default mode, returning the byte count.
- [LIKE](https://mariadb.com/docs/server/reference/sql-functions/string-functions/like.md): Complete LIKE operator reference: LIKE/NOT LIKE pattern matching syntax, % and \_ wildcards, ESCAPE clause, NULL behavior, and collation case-sensitivity.
- [LOAD\_FILE](https://mariadb.com/docs/server/reference/sql-functions/string-functions/load_file.md): Read a file from the server. This function reads the content of a file located on the server host and returns it as a string.
- [LOCATE](https://mariadb.com/docs/server/reference/sql-functions/string-functions/locate.md): Return the position of the first occurrence of a substring. This function finds the starting position of a substring within a string.
- [LOWER](https://mariadb.com/docs/server/reference/sql-functions/string-functions/lower.md): Convert a string to lowercase. This function returns the string with all characters converted to lowercase.
- [LPAD](https://mariadb.com/docs/server/reference/sql-functions/string-functions/lpad.md): Left-pad a string. This function pads a string on the left side with a specified string until it reaches a certain length.
- [LTRIM](https://mariadb.com/docs/server/reference/sql-functions/string-functions/ltrim.md): Remove leading spaces. This function returns the string with any leading whitespace characters removed.
- [MAKE\_SET](https://mariadb.com/docs/server/reference/sql-functions/string-functions/make_set.md): Return a set of comma-separated strings. This function returns a string consisting of substrings corresponding to the set bits in a given number.
- [MATCH AGAINST](https://mariadb.com/docs/server/reference/sql-functions/string-functions/match-against.md): Perform a full-text search. This construct searches for a text query against a set of columns indexed with a FULLTEXT index.
- [MID](https://mariadb.com/docs/server/reference/sql-functions/string-functions/mid.md): Synonym for SUBSTRING(). Returns a substring starting at a specified position for a given length.
- [NATURAL\_SORT\_KEY](https://mariadb.com/docs/server/reference/sql-functions/string-functions/natural_sort_key.md): Generate a sort key for natural ordering. This function produces a key that allows strings containing numbers to be sorted in a human-readable order.
- [NOT LIKE](https://mariadb.com/docs/server/reference/sql-functions/string-functions/not-like.md): Negated pattern matching. This operator tests whether a string does NOT match a specified SQL pattern.
- [NOT REGEXP](https://mariadb.com/docs/server/reference/sql-functions/string-functions/not-regexp.md): Negated regular expression matching. This operator tests whether a string does NOT match a specified regular expression pattern.
- [OCTET\_LENGTH](https://mariadb.com/docs/server/reference/sql-functions/string-functions/octet_length.md): Return the length of a string in bytes. This function is a synonym for LENGTH() and returns the number of bytes in the string.
- [ORD](https://mariadb.com/docs/server/reference/sql-functions/string-functions/ord.md): Return the numeric value of the first character. This function returns the code for the leftmost character, supporting multi-byte characters.
- [POSITION](https://mariadb.com/docs/server/reference/sql-functions/string-functions/position.md): Synonym for LOCATE(). Returns the position of the first occurrence of a substring within a string.
- [QUOTE](https://mariadb.com/docs/server/reference/sql-functions/string-functions/quote.md): Quote a string for SQL usage. This function produces a string ready for use as a data value in an SQL statement, escaping special characters.
- [REPEAT Function](https://mariadb.com/docs/server/reference/sql-functions/string-functions/repeat-function.md): Repeat a string. This function returns a string consisting of the input string repeated a specified number of times.
- [REPLACE Function](https://mariadb.com/docs/server/reference/sql-functions/string-functions/replace-function.md): Complete REPLACE Function reference for MariaDB. Complete function guide with syntax, parameters, return values, and usage examples for production use.
- [REVERSE](https://mariadb.com/docs/server/reference/sql-functions/string-functions/reverse.md): Reverse a string. This function returns the string with the order of its characters reversed.
- [RIGHT](https://mariadb.com/docs/server/reference/sql-functions/string-functions/right.md): Return the rightmost characters. This function returns the specified number of characters from the end (right) of a string.
- [RPAD](https://mariadb.com/docs/server/reference/sql-functions/string-functions/rpad.md): Right-pad a string. This function pads a string on the right side with a specified string until it reaches a certain length.
- [RTRIM](https://mariadb.com/docs/server/reference/sql-functions/string-functions/rtrim.md): Remove trailing spaces. This function returns the string with any trailing whitespace characters removed.
- [SFORMAT](https://mariadb.com/docs/server/reference/sql-functions/string-functions/sformat.md): Format strings with arbitrary patterns. This function allows complex string formatting using a pattern string and arguments.
- [SOUNDEX](https://mariadb.com/docs/server/reference/sql-functions/string-functions/soundex.md): Return the Soundex string. This function calculates the Soundex key for a string, allowing comparison of words that sound similar.
- [SOUNDS LIKE](https://mariadb.com/docs/server/reference/sql-functions/string-functions/sounds-like.md): Compare strings by sound. This operator tests if two strings have the same Soundex value, useful for fuzzy matching.
- [SPACE](https://mariadb.com/docs/server/reference/sql-functions/string-functions/space.md): Return a string of spaces. This function returns a string consisting of a specified number of space characters.
- [STRCMP](https://mariadb.com/docs/server/reference/sql-functions/string-functions/strcmp.md): Compare two strings. This function returns 0 if strings are equal, -1 if the first is smaller, and 1 if the first is larger.
- [SUBSTR](https://mariadb.com/docs/server/reference/sql-functions/string-functions/substr.md)
- [SUBSTRING](https://mariadb.com/docs/server/reference/sql-functions/string-functions/substring.md): Complete SUBSTRING() reference: syntax forms (pos,len, FROM/FOR), negative position from end, NULL handling, and Oracle sql\_mode position 0 behavior.
- [SUBSTRING\_INDEX](https://mariadb.com/docs/server/reference/sql-functions/string-functions/substring_index.md): Complete SUBSTRING\_INDEX() reference: SUBSTRING\_INDEX(str,delim,count) syntax, positive/negative count, case-sensitive delimiter, NULL rules.
- [TO\_BASE64](https://mariadb.com/docs/server/reference/sql-functions/string-functions/to_base64.md): Encode a string to base-64. This function converts a string argument to its base-64 encoded form.
- [TO\_CHAR](https://mariadb.com/docs/server/reference/sql-functions/string-functions/to_char.md): Convert to string. This function converts a value (often date/time) to a string, potentially using a format mask.
- [TRIM](https://mariadb.com/docs/server/reference/sql-functions/string-functions/trim.md): Remove spaces from both ends. This function removes leading and trailing whitespace (or other specified characters) from a string.
- [TRIM\_ORACLE](https://mariadb.com/docs/server/reference/sql-functions/string-functions/trim_oracle.md): Oracle-compatible TRIM function. This version of TRIM provides compatibility with Oracle's syntax for removing characters from a string.
- [Type Conversion](https://mariadb.com/docs/server/reference/sql-functions/string-functions/type-conversion.md): Understand Type Conversion in MariaDB. Learn the rules for implicit conversion during comparisons and arithmetic, and how to use CAST for predictable results.
- [UCASE](https://mariadb.com/docs/server/reference/sql-functions/string-functions/ucase.md): Synonym for UPPER(). Converts a string to uppercase characters.
- [UNHEX](https://mariadb.com/docs/server/reference/sql-functions/string-functions/unhex.md): Convert hexadecimal to string. This function interprets pairs of hexadecimal digits as numbers and converts them to the characters they represent.
- [UPDATEXML](https://mariadb.com/docs/server/reference/sql-functions/string-functions/updatexml.md): Replace a portion of XML. This function replaces a section of XML markup matching an XPath expression with a new XML fragment.
- [UPPER](https://mariadb.com/docs/server/reference/sql-functions/string-functions/upper.md): Convert a string to uppercase. This function returns the string with all characters converted to uppercase.
- [WEIGHT\_STRING](https://mariadb.com/docs/server/reference/sql-functions/string-functions/weight_string.md): Return the weight string. This function returns the binary string that represents the sorting and comparison value of the input string.
- [Regular Expressions Functions](https://mariadb.com/docs/server/reference/sql-functions/string-functions/regular-expressions-functions.md): Learn about regular expression functions in MariaDB Server. This section details SQL functions for powerful pattern matching and manipulation of string data using regular expressions.
- [Regular Expressions Overview](https://mariadb.com/docs/server/reference/sql-functions/string-functions/regular-expressions-functions/regular-expressions-overview.md): Get an overview of regex usage. This page introduces the pattern matching capabilities and common metacharacters used in MariaDB regular expressions.
- [PCRE - Perl Compatible Regular Expressions](https://mariadb.com/docs/server/reference/sql-functions/string-functions/regular-expressions-functions/pcre.md): Understand MariaDB's regex support. This concept page explains the PCRE library integration, detailing supported syntax, character classes, and special characters.
- [REGEXP](https://mariadb.com/docs/server/reference/sql-functions/string-functions/regular-expressions-functions/regexp.md): Complete REGEXP operator reference: expr REGEXP/RLIKE pat syntax, 1/0/NULL return values, NOT REGEXP aliases, BINARY case-sensitivity, default\_regex\_flags.
- [REGEXP\_INSTR](https://mariadb.com/docs/server/reference/sql-functions/string-functions/regular-expressions-functions/regexp_instr.md): Return the index of a regex match. This function finds the starting position of the first substring that matches the given pattern.
- [REGEXP\_REPLACE](https://mariadb.com/docs/server/reference/sql-functions/string-functions/regular-expressions-functions/regexp_replace.md): Replace regex matches in a string. This function substitutes occurrences of a pattern with a specified replacement string.
- [REGEXP\_SUBSTR](https://mariadb.com/docs/server/reference/sql-functions/string-functions/regular-expressions-functions/regexp_substr.md): Return the substring matching a regex. This function extracts the actual part of the string that matches the given pattern.
- [RLIKE](https://mariadb.com/docs/server/reference/sql-functions/string-functions/regular-expressions-functions/rlike.md): Synonym for REGEXP. This operator performs a regular expression match against a string argument.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mariadb.com/docs/server/reference/sql-functions/string-functions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
