

# String functions and operators in DuckDB

Use string functions and operators to build, search, compare, and reformat text values.

Text comparisons and the `LIKE` and `GLOB` pattern matches are case-sensitive, and `ILIKE` ignores case. Positions in a string start at `1`, and most functions return `NULL` when an argument is `NULL`, though some, such as `concat`, skip `NULL` arguments.

**Topics**
+ [General](duckdb-functions-string-general.md)
+ [Pattern matching](duckdb-functions-string-pattern-matching.md)
+ [Regex](duckdb-functions-string-regular-expressions.md)
+ [Formatting](duckdb-functions-string-formatting.md)
+ [Unicode](duckdb-functions-string-unicode-characters.md)
+ [Collations](duckdb-functions-string-collation-sort-keys.md)
+ [Similarity](duckdb-functions-string-similarity.md)
+ [Paths and URLs](duckdb-functions-string-paths-and-urls.md)

The following table lists the string functions and operators, with a link to the description of each one.


| Function or operator | Description | 
| --- | --- | 
| [^@](duckdb-functions-string-pattern-matching.md#athena-duckdb-functions-string-starts-with-operator) | Tests whether a string begins with a given prefix. | 
| [\|\|](duckdb-functions-string-general.md#athena-duckdb-functions-string-concatenation-operator) | Joins two strings, two lists, or two `BLOB` values into one value. | 
| [array\_extract](duckdb-functions-list-length-and-elements.md#athena-duckdb-functions-list-array-extract) | Returns the character at a position in a string. It also returns an element of a list or a field of a struct. The list and array functions topic describes it. | 
| [ascii](duckdb-functions-string-unicode-characters.md#athena-duckdb-functions-string-ascii) | Converts the first character of a string to its Unicode code point number. | 
| [chr](duckdb-functions-string-unicode-characters.md#athena-duckdb-functions-string-chr) | Returns the character for a Unicode code point. | 
| [Collations](duckdb-functions-string-collation-sort-keys.md#athena-duckdb-functions-string-collations) | Changes how strings compare and sort, for example to ignore case or accents, or to follow the rules of a language. | 
| [concat](duckdb-functions-string-general.md#athena-duckdb-functions-string-concat) | Concatenates one or more strings or lists, skipping `NULL` arguments. | 
| [concat\_ws](duckdb-functions-string-general.md#athena-duckdb-functions-string-concat-ws) | Concatenates strings with a separator between them, skipping `NULL` arguments. | 
| [contains](duckdb-functions-string-pattern-matching.md#athena-duckdb-functions-string-contains) | Tests whether a string contains a substring, a list contains an element, a map contains a key, or an unnamed struct contains a field value. | 
| [damerau\_levenshtein](duckdb-functions-string-similarity.md#athena-duckdb-functions-string-damerau-levenshtein) | Returns the edit distance between two strings, counting a swap of two adjacent characters as one edit. | 
| editdist3 | Alias of [levenshtein](duckdb-functions-string-similarity.md#athena-duckdb-functions-string-levenshtein). | 
| ends\_with | Alias of [suffix](duckdb-functions-string-pattern-matching.md#athena-duckdb-functions-string-suffix). | 
| [format](duckdb-functions-string-formatting.md#athena-duckdb-functions-string-format) | Builds a string by replacing `{}` placeholders with argument values. | 
| [format\_bytes](duckdb-functions-string-formatting.md#athena-duckdb-functions-string-format-bytes) | Converts a number of bytes to a readable size, such as `15.6 KiB`, in binary units. | 
| [formatReadableDecimalSize](duckdb-functions-string-formatting.md#athena-duckdb-functions-string-formatreadabledecimalsize) | Formats a number of bytes as text in decimal units, such as `16.0 kB` or `1.5 MB`. | 
| formatReadableSize | Alias of [format\_bytes](duckdb-functions-string-formatting.md#athena-duckdb-functions-string-format-bytes). | 
| [GLOB](duckdb-functions-string-pattern-matching.md#athena-duckdb-functions-string-glob) | Tests whether a string matches a file-name style pattern that uses the `*`, `?`, and `[]` wildcards. | 
| [hamming](duckdb-functions-string-similarity.md#athena-duckdb-functions-string-hamming) | Compares two strings of the same length character by character and returns how many positions differ. | 
| [hive\_partition\_component](duckdb-functions-string-paths-and-urls.md#athena-duckdb-functions-string-hive-partition-component) | Combines a partition column name and a value into one percent-encoded Hive-style path segment, such as `year=2024`. | 
| [icu\_sort\_key](duckdb-functions-string-collation-sort-keys.md#athena-duckdb-functions-string-icu-sort-key) | Returns a sort key that orders strings by the collation rules of a language. | 
| [ILIKE](duckdb-functions-string-pattern-matching.md#athena-duckdb-functions-string-ilike) | Tests whether a string matches a pattern that uses the `%` and `_` wildcards, ignoring case. | 
| [ilike\_escape](duckdb-functions-string-pattern-matching.md#athena-duckdb-functions-string-ilike-escape) | Tests whether a string matches a `LIKE` pattern, ignoring case, with an escape character that you choose. | 
| [instr](duckdb-functions-string-general.md#athena-duckdb-functions-string-instr) | Finds a search string in a string and returns the 1-based position where its first occurrence starts, or `0` if the string does not contain it. | 
| [jaccard](duckdb-functions-string-similarity.md#athena-duckdb-functions-string-jaccard) | Returns the Jaccard similarity of the sets of characters in two strings, from `0` to `1`. | 
| [jaro\_similarity](duckdb-functions-string-similarity.md#athena-duckdb-functions-string-jaro-similarity) | Returns the Jaro similarity of two strings, from `0` to `1`. | 
| [jaro\_winkler\_similarity](duckdb-functions-string-similarity.md#athena-duckdb-functions-string-jaro-winkler-similarity) | Returns the Jaro-Winkler similarity of two strings, from `0` to `1`, which can give a higher score when the strings share a prefix. | 
| lcase | Alias of [lower](duckdb-functions-string-general.md#athena-duckdb-functions-string-lower). | 
| [left](duckdb-functions-string-general.md#athena-duckdb-functions-string-left) | Returns the leftmost characters of a string. | 
| [left\_grapheme](duckdb-functions-string-unicode-characters.md#athena-duckdb-functions-string-left-grapheme) | Returns the leftmost grapheme clusters of a string, where each grapheme cluster is one character as a reader sees it. | 
| [length](duckdb-functions-list-length-and-elements.md#athena-duckdb-functions-list-length) | Returns the number of characters in a string. It also counts the elements of a list. The list and array functions topic describes it. | 
| [length\_grapheme](duckdb-functions-string-unicode-characters.md#athena-duckdb-functions-string-length-grapheme) | Returns the number of grapheme clusters in a string, where each grapheme cluster is one character as a reader sees it. | 
| [levenshtein](duckdb-functions-string-similarity.md#athena-duckdb-functions-string-levenshtein) | Returns the Levenshtein edit distance between two strings. | 
| [LIKE](duckdb-functions-string-pattern-matching.md#athena-duckdb-functions-string-like) | Tests whether a string matches a pattern that uses the `%` and `_` wildcards, with case-sensitive matching. | 
| [like\_escape](duckdb-functions-string-pattern-matching.md#athena-duckdb-functions-string-like-escape) | Tests whether a string matches a `LIKE` pattern, with an escape character that you choose. | 
| [lower](duckdb-functions-string-general.md#athena-duckdb-functions-string-lower) | Converts a string to lowercase. | 
| [lpad](duckdb-functions-string-general.md#athena-duckdb-functions-string-lpad) | Pads a string on the left to a given length, or shortens it to that length. | 
| [ltrim](duckdb-functions-string-general.md#athena-duckdb-functions-string-ltrim) | Removes leading spaces, or other leading characters that you choose, from a string. | 
| mismatches | Alias of [hamming](duckdb-functions-string-similarity.md#athena-duckdb-functions-string-hamming). | 
| [nfc\_normalize](duckdb-functions-string-unicode-characters.md#athena-duckdb-functions-string-nfc-normalize) | Converts a string to Unicode Normalization Form C (NFC). | 
| [not\_ilike\_escape](duckdb-functions-string-pattern-matching.md#athena-duckdb-functions-string-not-ilike-escape) | Tests whether a string does not match a `LIKE` pattern, ignoring case, with an escape character that you choose. | 
| [not\_like\_escape](duckdb-functions-string-pattern-matching.md#athena-duckdb-functions-string-not-like-escape) | Tests whether a string does not match a `LIKE` pattern, with an escape character that you choose. | 
| ord | Alias of [unicode](duckdb-functions-string-unicode-characters.md#athena-duckdb-functions-string-unicode). | 
| [overlay](duckdb-functions-string-general.md#athena-duckdb-functions-string-overlay) | Replaces part of a string, starting at a given character position, with another string. | 
| [parse\_dirname](duckdb-functions-string-paths-and-urls.md#athena-duckdb-functions-string-parse-dirname) | Returns the first component of a path, such as its top-level directory. | 
| [parse\_dirpath](duckdb-functions-string-paths-and-urls.md#athena-duckdb-functions-string-parse-dirpath) | Returns the directory part of a path, without its last component. | 
| [parse\_filename](duckdb-functions-string-paths-and-urls.md#athena-duckdb-functions-string-parse-filename) | Returns the last component of a path, such as a file name, optionally without its extension. | 
| [parse\_formatted\_bytes](duckdb-functions-string-formatting.md#athena-duckdb-functions-string-parse-formatted-bytes) | Converts a readable size, such as `16 KiB`, to a number of bytes. | 
| [parse\_path](duckdb-functions-string-paths-and-urls.md#athena-duckdb-functions-string-parse-path) | Splits a path into a list of its components. | 
| [path\_join](duckdb-functions-string-paths-and-urls.md#athena-duckdb-functions-string-path-join) | Joins path components into one path. | 
| position | Alias of [instr](duckdb-functions-string-general.md#athena-duckdb-functions-string-instr). | 
| [prefix](duckdb-functions-string-pattern-matching.md#athena-duckdb-functions-string-prefix) | Tests whether a string starts with another string. | 
| [printf](duckdb-functions-string-formatting.md#athena-duckdb-functions-string-printf) | Formats values into a string with C-style `%` format specifiers. | 
| [regexp\_escape](duckdb-functions-string-regular-expressions.md#athena-duckdb-functions-string-regexp-escape) | Escapes the characters in a string that have special meaning in a regular expression. | 
| [regexp\_extract](duckdb-functions-string-regular-expressions.md#athena-duckdb-functions-string-regexp-extract) | Returns the part of a string that matches a regular expression, or one or more of its capturing groups. | 
| [regexp\_extract\_all](duckdb-functions-string-regular-expressions.md#athena-duckdb-functions-string-regexp-extract-all) | Returns every non-overlapping match of a regular expression in a string, as a list. | 
| [regexp\_full\_match](duckdb-functions-string-regular-expressions.md#athena-duckdb-functions-string-regexp-full-match) | Tests whether a whole string matches a regular expression. | 
| [regexp\_matches](duckdb-functions-string-regular-expressions.md#athena-duckdb-functions-string-regexp-matches) | Tests whether a string contains a match for a regular expression. | 
| [regexp\_replace](duckdb-functions-string-regular-expressions.md#athena-duckdb-functions-string-regexp-replace) | Replaces the first match, or every match, of a regular expression in a string. | 
| regexp\_split\_to\_array | Alias of [string\_split\_regex](duckdb-functions-string-regular-expressions.md#athena-duckdb-functions-string-string-split-regex). | 
| [regexp\_split\_to\_table](duckdb-functions-string-regular-expressions.md#athena-duckdb-functions-string-regexp-split-to-table) | Splits a string at each match of a regular expression and returns one row for each part. | 
| [repeat](duckdb-functions-binary-blobs-and-encoding.md#athena-duckdb-functions-binary-repeat) | Returns a string repeated a given number of times. It also repeats blobs and lists. The blob and bitstring functions topic describes it. | 
| [replace](duckdb-functions-string-general.md#athena-duckdb-functions-string-replace) | Replaces every occurrence of a substring with another string. | 
| [reverse](duckdb-functions-string-general.md#athena-duckdb-functions-string-reverse) | Returns the characters of a string in reverse order. | 
| [right](duckdb-functions-string-general.md#athena-duckdb-functions-string-right) | Returns the rightmost characters of a string. | 
| [right\_grapheme](duckdb-functions-string-unicode-characters.md#athena-duckdb-functions-string-right-grapheme) | Returns the rightmost grapheme clusters of a string. | 
| [rpad](duckdb-functions-string-general.md#athena-duckdb-functions-string-rpad) | Pads a string on the right to a given length, or shortens it to that length. | 
| [rtrim](duckdb-functions-string-general.md#athena-duckdb-functions-string-rtrim) | Removes trailing spaces, or other trailing characters, from a string. | 
| split | Alias of [string\_split](duckdb-functions-string-general.md#athena-duckdb-functions-string-string-split). | 
| [split\_part](duckdb-functions-string-general.md#athena-duckdb-functions-string-split-part) | Splits a string at a delimiter and returns the part at a given position. | 
| starts\_with | Alias of [^@](duckdb-functions-string-pattern-matching.md#athena-duckdb-functions-string-starts-with-operator). | 
| str\_split | Alias of [string\_split](duckdb-functions-string-general.md#athena-duckdb-functions-string-string-split). | 
| str\_split\_regex | Alias of [string\_split\_regex](duckdb-functions-string-regular-expressions.md#athena-duckdb-functions-string-string-split-regex). | 
| [string\_split](duckdb-functions-string-general.md#athena-duckdb-functions-string-string-split) | Splits a string at a separator and returns the parts as a list. | 
| [string\_split\_regex](duckdb-functions-string-regular-expressions.md#athena-duckdb-functions-string-string-split-regex) | Splits a string at each match of a regular expression and returns the parts as a list. | 
| string\_to\_array | Alias of [string\_split](duckdb-functions-string-general.md#athena-duckdb-functions-string-string-split). | 
| [strip\_accents](duckdb-functions-string-unicode-characters.md#athena-duckdb-functions-string-strip-accents) | Removes accent marks from the letters in a string. | 
| [strlen](duckdb-functions-string-unicode-characters.md#athena-duckdb-functions-string-strlen) | Returns the number of bytes in a string. | 
| strpos | Alias of [instr](duckdb-functions-string-general.md#athena-duckdb-functions-string-instr). | 
| substr | Alias of [substring](duckdb-functions-string-general.md#athena-duckdb-functions-string-substring). | 
| [substring](duckdb-functions-string-general.md#athena-duckdb-functions-string-substring) | Returns part of a string, starting at a given character position. | 
| [substring\_grapheme](duckdb-functions-string-unicode-characters.md#athena-duckdb-functions-string-substring-grapheme) | Returns part of a string, counting positions in grapheme clusters instead of characters. | 
| [suffix](duckdb-functions-string-pattern-matching.md#athena-duckdb-functions-string-suffix) | Tests whether a string ends with another string. | 
| [to\_base](duckdb-functions-string-formatting.md#athena-duckdb-functions-string-to-base) | Converts a number to a string of digits in a given base. | 
| [translate](duckdb-functions-string-general.md#athena-duckdb-functions-string-translate) | Replaces or removes individual characters in a string. | 
| [trim](duckdb-functions-string-general.md#athena-duckdb-functions-string-trim) | Removes spaces, or other characters that you choose, from both ends of a string. | 
| ucase | Alias of [upper](duckdb-functions-string-general.md#athena-duckdb-functions-string-upper). | 
| [unicode](duckdb-functions-string-unicode-characters.md#athena-duckdb-functions-string-unicode) | Returns the Unicode code point of the first character in a string. | 
| [upper](duckdb-functions-string-general.md#athena-duckdb-functions-string-upper) | Converts a string to uppercase. | 
| [url\_decode](duckdb-functions-string-paths-and-urls.md#athena-duckdb-functions-string-url-decode) | Decodes a percent-encoded string, such as part of a URL. | 
| [url\_encode](duckdb-functions-string-paths-and-urls.md#athena-duckdb-functions-string-url-encode) | Percent-encodes a string so that you can use it in a URL. | 