# split

Splits a string by a separator into an array of strings.

#### Syntax

```
split(separator, input)
```

or chained:

```
<string>.split(separator)
```

#### Arguments

* **separator** (`string`) - The delimiter to split on.
* **input** (`string`, optional when chained) - The string to split.

#### Examples

**Chained usage**

```
"a,b,c".split(",")
// ["a", "b", "c"]
```

**Function call**

```
split("-", "one-two-three")
// ["one", "two", "three"]
```

**CLI usage — split a CSV-like field**

```bash
$ echo '{"tags": "go,cli,json"}' | dasel -i json 'tags.split(",")'
[
    "go",
    "cli",
    "json"
]
```

**Chained with other functions**

```
"hello world".split(" ").first()
// "hello"
```


---

# 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://daseldocs.tomwright.me/functions/split.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.
