> ## Documentation Index
> Fetch the complete documentation index at: https://docs.e6data.com/llms.txt
> Use this file to discover all available pages before exploring further.

# String functions

> String functions operate on text expressions. The common functions below return NULL for a NULL required argument unless the row documents a different behavior. Character counts an

ReferenceApplies to: Unified engine deployments

String functions operate on text expressions. The common functions below return NULL for a NULL required argument unless the row documents a different behavior. Character counts and byte counts are different for multibyte text.

## Case, length, and trimming

| Function | Returns | Behavior |
| - | - | - |
| `lower(text)`, `lcase(text)` | STRING | Lowercase text |
| `upper(text)`, `ucase(text)` | STRING | Uppercase text |
| `character_length(text)` | Integer | Character count; `char_length` is an alias |
| `octet_length(text)` | Integer | Byte count |
| `trim(text)` | STRING | Remove surrounding trim characters, ordinarily spaces |
| `ltrim(text)`, `rtrim(text)` | STRING | Trim one side |

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT c_customer_id, LOWER(c_first_name) AS lower_name,
       UPPER(c_last_name) AS upper_name,
       CHARACTER_LENGTH(c_first_name) AS name_length,
       LTRIM(CONCAT(' ', c_first_name)) AS trimmed_name
FROM demo.tpcds.customer
ORDER BY c_customer_sk
LIMIT 5;
```

The Native translation of two-sided TRIM currently emits an unavailable `btrim` function. The live example uses LTRIM.

## Combining and extracting text

| Function | Returns | Behavior |
| - | - | - |
| `concat(value, ...)` | STRING | Concatenate arguments; null behavior follows the resolved function |
| `concat_ws(separator, value, ...)` | STRING | Join values with a separator; null value arguments are skipped |
| `substr(text, start[, length])` | STRING | Substring using SQL's one-based position |
| `replace(text, from, to)` | STRING | Replace matching text occurrences |
| `reverse(text)` | STRING | Reverse character order |
| `starts_with(text, prefix)` | BOOLEAN | Test a prefix |
| `ends_with(text, suffix)` | BOOLEAN | Test a suffix |
| `split_part(text, delimiter, position)` | STRING | Select a delimited text part |

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT c_customer_id,
       CONCAT_WS(' ', c_first_name, c_last_name) AS full_name,
       SUBSTR(c_customer_id, 1, 4) AS code_prefix,
       REPLACE(c_customer_id, 'A', 'X') AS replaced_code
FROM demo.tpcds.customer
ORDER BY c_customer_sk
LIMIT 5;
```

## Regular expressions

`regexp_like(text, pattern)` tests a regular expression. `regexp_replace(text, pattern, replacement)` substitutes matching text. Supported flags and replacement syntax depend on the resolved function and backend; validate patterns before moving a script from another dialect.

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT c_customer_id,
       REGEXP_LIKE(c_customer_id, '^AAAA') AS has_prefix,
       REGEXP_REPLACE(c_customer_id, 'A', 'x') AS changed_code
FROM demo.tpcds.customer
ORDER BY c_customer_sk
LIMIT 5;
```

Use LIKE for simple wildcard matches. The SQL operator SIMILAR TO is unavailable under Native execution because its translation would change semantics.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.