## 📝 Text Functions

Functions for reading, cleaning, searching, and transforming text strings.

| Function        | Description                                                                                                                   | Syntax                                                | Parameters                                                                                                                                      | Example                                                            |
| --------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ |
| `LEFT`          | Extracts a given number of characters starting from the left of a text string.                                                | `LEFT(Text, Number)`                                  | **Text** — the source text.<br>**Number** — how many characters to extract from the left.                                                       | `LEFT('abcde', 2) = 'ab'`                                          |
| `RIGHT`         | Extracts a given number of characters starting from the right of a text string.                                               | `RIGHT(Text, Number)`                                 | **Text** — the source text.<br>**Number** — how many characters to extract from the right.                                                      | `RIGHT('abcde', 2) = 'de'`                                         |
| `LEN`           | Returns the number of characters in a text string.                                                                            | `LEN(Text)`                                           | **Text** — the text to measure.                                                                                                                 | `LEN('abc') = 3`                                                   |
| `LOWER`         | Converts a text string to lowercase.                                                                                          | `LOWER(Text)`                                         | **Text** — the text to convert.                                                                                                                 | `LOWER('ArrAnge') = 'arrange'`                                     |
| `UPPER`         | Converts a text string to uppercase.                                                                                          | `UPPER(Text)`                                         | **Text** — the text to convert.                                                                                                                 | `UPPER('aPpLe') = 'APPLE'`                                         |
| `TRIM`          | Removes leading and trailing whitespace from a text string.                                                                   | `TRIM(Text)`                                          | **Text** — the text to clean up.                                                                                                                | `TRIM(' abc ') = 'abc'`                                            |
| `REVERSE`       | Reverses the order of characters in a text string.                                                                            | `REVERSE(Text)`                                       | **Text** — the text to reverse.                                                                                                                 | `REVERSE('abc') = 'cba'`                                           |
| `SEARCH`        | Returns the position of the first character where a search text is found within a source text; returns `0` if it isn't found. | `SEARCH(Text, Search Text)`                           | **Text** — the text to search within.<br>**Search Text** — the text to look for.                                                                | `SEARCH('a b c test', 'test') = 7`<br>`SEARCH('none', 'test') = 0` |
| `REPLACE`       | Finds a piece of text within a string and replaces every occurrence with another piece of text.                               | `REPLACE(Source Text, Search Text, Replacement Text)` | **Source Text** — the original text.<br>**Search Text** — the text to find.<br>**Replacement Text** — the text to replace it with.              | `REPLACE('test a b c test', 'test', '1') = '1 a b c 1'`            |
| `REGEX_REPLACE` | Replaces every match of a regular expression pattern within a text string with a replacement string.                          | `REGEX_REPLACE(Text, Pattern, Replacement)`           | **Text** — the original text.<br>**Pattern** — the regular expression to match.<br>**Replacement** — the text to insert in place of each match. | `REGEX_REPLACE('abc', 'a', '1') = '1bc'`                           |
| `T`             | Returns the value if it's text; returns blank if it isn't.                                                                    | `T(Value)`                                            | **Value** — the value to check.                                                                                                                 | `T(10) = `(blank)<br>`T('Hello') = 'Hello'`                        |
| `TOTEXT`        | Converts a value (number, date, boolean, etc.) into text.                                                                     | `TOTEXT(Value)`                                       | **Value** — the value to convert.                                                                                                               | `TOTEXT(10) = '10'`                                                |


