# Split String Iterator

> Iterate over a string separated by a delimiter.

- ID: `split_string`
- Type: Loop
- Category: [Strings](https://inventor.bot/docs/reference/blocks/strings.md)

- Loop block: write `for item := range split_string(Args{...}) { ... }` and read the current item's outputs from `item`. See loops.

**Inputs**

| Name | Required | Description | Value |
| --- | --- | --- | --- |
| `text` | yes | String to split. | e.g. `"a,b,c"` |
| `delimiter` | yes | Delimiter to split on. | e.g. `","` |
| `sort` |  | Order of iteration. | `"Normal"`, `"Reverse"`, `"Random"`, `"Alphabetical"`, `"Reverse Alphabetical"`, `"Ascending Numeric"`, `"Descending Numeric"` |
| `body` |  | Blocks to run for each part. | blocks: `func() { ... }` |

**Outputs**

| Name | Description | Value |
| --- | --- | --- |
| `iteration_number` | 0-based iteration index. | e.g. `"0"` |
| `total_iterations` | Total number of split parts. | e.g. `"3"` |
| `split_string` | Current split value. | e.g. `"a"` |
| `split_string_length` | Length of the current split value. | e.g. `"1"` |

**Example**

```go
for part := range split_string(Args{text: "a,b,c", delimiter: ","}) {
	send_text_message(Args{
		channel_id:      trigger.channel_id,
		message_content: "Split String: " + part.split_string,
	})
}
```