---
url: /flow/guide/scripting-reference/functions/string/splitstring.md
---

# SplitString

## Declaration

`Function SplitString( S : string; aIndex : integer; aChar : Char) : string`

### Example

```pascal
procedure OnMapEvent(var Value:Variant);
begin
  Value := SplitString('abc|123|456', 2, '|'); //returns 123
end;
```

## Description

Splits a string based on aChar character and returns the item given by aIndex. aIndex is a 1-based array - an index value of 1 returns the first split item.

If the string does not contain aChar, then the whole string is returned as the first split item.
