> For the complete documentation index, see [llms.txt](https://doc.wearepatchworks.com/product-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/process-flow-shapes/standard-shapes/map-shape/working-with-field-transformations/available-transform-functions/string-transform-functions/split-string-transform-function.md).

# Split string transform function

## Introduction

The **split string** transform function is used to split elements of a string into an array, with a user-defined delimiter. For example, you might have product data in a string:

{% code lineNumbers="true" %}

```json
{"fruit_in":"apples,oranges,pears,grapes"}
```

{% endcode %}

...and need to convert these items to an array before pushing to the destination system:

{% code lineNumbers="true" %}

```json
{
  "fruit_out": [
    "apples",
    "oranges",
    "pears",
    "grapes"
  ]
}
```

{% endcode %}

In this case, items in our source string value are delimited with a comma, so we can use this to determine where each split occurs. The transform checks incoming string values and determines each array item to be the word after each comma.

## Adding a split string transform

**Step 1**\
In your process flow, access settings for your map shape:

<div align="left"><figure><img src="/files/zUcwDiQRVMuaR18imbmt" alt="" width="274"><figcaption></figcaption></figure></div>

**Step 2**\
Select the **add transform** icon for the required mapping rule - for example:

<div align="left"><figure><img src="/files/ufHThGzA1OkcX2J2I7Qe" alt=""><figcaption></figcaption></figure></div>

**Step 3**\
Click the **add transform** button:

<div align="left"><figure><img src="/files/0doCARKg5Elul2SATK1T" alt=""><figcaption></figcaption></figure></div>

**Step 4**\
Click in the **name** field to access a list of all available transform functions, then select **split** from the **string** category:

<div align="left"><figure><img src="/files/W0oF0xfCKPkjAGnIwitC" alt=""><figcaption></figcaption></figure></div>

**Step 5**\
In the delimiter field, enter the character that delimits elements in the string:

<figure><img src="/files/qE7dNZuKBZpz8W6Gze6Y" alt=""><figcaption></figcaption></figure>

If you use any of the following characters, they should be escaped:\
\
`.` `+` `*` `?` `^` `$` `(` `)` `[` `]` `{` `}` `|` `\` `/`

For example, a delimiter of `*` would be entered as:

`\*`

{% hint style="info" %}
A space is a valid character.
{% endhint %}

**Step 6**\
Click the **add field** button:

<div align="left"><figure><img src="/files/O4tROerGzhdO9lqzBlI1" alt=""><figcaption></figcaption></figure></div>

**Step 7**\
Click in **source fields** and select the source field to be used for this transform:

<div align="left"><figure><img src="/files/7q8RCzh46r92laqpSoha" alt=""><figcaption></figcaption></figure></div>

**Step 8**\
Accept your changes (twice).

**Step 9**\
Save the transform. You'll notice that the transform icon is updated to indicate that a transform function is present for the mapping row - for example:

<div align="left"><figure><img src="/files/34iNmy2ncI3Dw9PQReFD" alt=""><figcaption></figcaption></figure></div>
