---
name: "splitString"
type: command
status: ok
groups: ["Strings"]
arma3_since: "1.50"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/splitString
revid: 377128
updated: 2026-01-01T10:23:07Z
---

# splitString

*Command · Strings · Arma 3 v1.50*

## Description

Splits the provided **ANSI** string into an array of tokens according to given delimiters.

> [!NOTE]
> For Unicode support, see [forceUnicode](../commands/forceUnicode.md).

## Syntax

```sqf
str splitString delimiters
```

**Parameters:**

- `str`: [String](../topics/String.md) - the string to split
- `delimiters`: [String](../topics/String.md) - one or more characters, each used as a separate delimiter; if empty, *str* is split by each character

**Returns:** [Array](../topics/Array.md) of [String](../topics/String.md)s

## Examples

### Example 1

```sqf
_str = "- This, is a sample string." splitString "-,. "; // ["This","is","a","sample","string"]
_str joinString "#"; // "This#is#a#sample#string"
```

### Example 2

```sqf
"\A3\ui_f\data\map\vehicleicons\iconLogic_ca.paa" splitString "\."; // ["A3","ui_f","data","map","vehicleicons","iconLogic_ca","paa"]
```

### Example 3

```sqf
"1:2:3" splitString ":"; // ["1","2","3"]
```

### Example 4

```sqf
"Japa is the best!" splitString "" joinString " "; // "J a p a   i s   t h e   b e s t !"
```

### Example 5

```sqf
_cmd = currentMagazineDetail player; // "9mm 16Rnd Mag(13/16)[id/cr:10000011/0]"
_cmd splitString "([ ]/:)"; // ["9mm","16Rnd","Mag","13","16","id","cr","10000011","0"]
```

### Example 6

Remove all \r\n from file:

```sqf
loadFile "somefile.txt" splitString toString [13,10] joinString " ";
```

## See also

[joinString](../commands/joinString.md) · [set](../commands/set.md) · [resize](../commands/resize.md) · [reverse](../commands/reverse.md) · [select](../commands/select.md) · [in](../commands/in.md) · [find](../commands/find.md) · [toArray](../commands/toArray.md) · [forEach](../commands/forEach.md) · [count](../commands/count.md) · [deleteAt](../commands/deleteAt.md) · [deleteRange](../commands/deleteRange.md) · [append](../commands/append.md) · [sort](../commands/sort.md) · [param](../commands/param.md) · [params](../commands/params.md) · [arrayIntersect](../commands/arrayIntersect.md) · [toString](../commands/toString.md) · [endl](../commands/endl.md) · [forceUnicode](../commands/forceUnicode.md)

## Community notes

**BaerMitUmlaut** — 2016-05-17

This command is unreliable/broken when it comes to some non-ASCII characters (as of Arma 3 v1.58):

```sqf
"Mörser" splitString "" // -> ["M"," "," ","r","s","e","r"]
"Mörser" splitString "ö" // -> ["M","rser"]
"Mörser" splitString "ä" // -> ["M"," rser"]
```

---

**Killzone_Kid** — 2016-10-17

This commands works only with ASCII chars, any chars with codes > 127, also used in different languages, will be converted to [" ", " "]. Use [toArray](../commands/toArray.md) to preserve special characters:

```sqf
_spaced = toArray "Mörser" apply {toString [_x]} joinString " "; // M ö r s e r
```

---

**R3vo** — 2019-07-19

When working with string which contain linebreaks...

```sqf
"stringWith" + endl + "Linebreak" splitString ",; ";
/*
result is ["someStringWith
Linebreak"]
*/
```

...one can remove those by adding [endl](../commands/endl.md) as delimiter

```sqf
"stringWith" + endl + "Linebreak" splitString ",; " + endl; // result is ["someStringWith","Linebreak"]
```

<sub>Source: [BI Community Wiki — splitString](https://community.bistudio.com/wiki/splitString) (revision 377128).</sub>
