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

<AgentInstructions>

## Submitting Feedback

If you encounter incorrect, outdated, or confusing documentation on this page, submit feedback:

POST https://docs.firebolt.io/feedback

```json
{
  "path": "/reference-sql/functions-reference/string/string-to-array",
  "feedback": "Description of the issue"
}
```

Only submit feedback when you have something specific and actionable to report.

</AgentInstructions>

> Reference material for STRING_TO_ARRAY function

# STRING_TO_ARRAY

Splits a string into an array of strings based on a specified delimiter, with the following behaviors:

* If the delimiter is an empty string `''`, the result is an array containing the entire original input string as a single element.
* If the delimiter is `NULL`, the string is split into individual characters, with one character per array element.

## Syntax

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
STRING_TO_ARRAY(<string>, <delimiter>)
```

## Parameters

| Parameter     | Description                           |
| :------------ | :------------------------------------ |
| `<string>`    | The string to split.                  |
| `<delimiter>` | The separator to split the string by. |

## Return Types

`ARRAY(TEXT)`

## Examples

**Example**

The following code example splits the string `stephen70|esimpson|ruthgill|` at each `|` character and returns the resulting array as `nicknames`:

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT STRING_TO_ARRAY('stephen70|esimpson|ruthgill|', '|') AS nicknames;
```

**Returns**

| nicknames (ARRAY(TEXT))            |
| :--------------------------------- |
| `{stephen70,esimpson,ruthgill,""}` |

**Example**

The following code example calls `STRING_TO_ARRAY` with an empty delimiter, producing an array containing a single element which contains the input text:

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT STRING_TO_ARRAY('firebolt', '') as size_one_array;
```

**Returns**

| size\_one\_array (ARRAY(TEXT)) |
| :----------------------------- |
| `{firebolt}`                   |

**Example**

The following example calls `STRING_TO_ARRAY` with `NULL` as the delimiter, splitting the text into individual characters:

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT STRING_TO_ARRAY('firebolt', NULL) AS single_characters;
```

**Returns**

| single\_characters (ARRAY(TEXT)) |
| :------------------------------- |
| `{f,i,r,e,b,o,l,t}`              |
