> 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/last-word-transform-function.md).

# Last word transform function

## Introduction

The **last word** transform function is used to extract the last word of an incoming string value, based on a user-defined delimiter. For example, you might have product data in a string:

{% code lineNumbers="true" %}

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

{% endcode %}

...and need to extract just the last item in the string for pushing to the destination system:

{% code lineNumbers="true" %}

```json
{"last_fruit":"grapes"}
```

{% endcode %}

In this case, items in our source string value are delimited with a comma, so we can use this to determine the last word. The transform checks incoming string values and determines the 'last word' to be the word after the last occurrence of the given delimiter.

## Adding a last word transform

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

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FU09ztECjyLK9gwyqm7PB%2Fadd%20last%20word%20transform%201.png?alt=media&amp;token=34e0472a-ad7e-455b-b908-61e433ad38ea" alt="" width="285"><figcaption></figcaption></figure></div>

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

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FNuV8NyUk38XgqElMzQ6n%2Fadd%20last%20word%20transform%202.png?alt=media&amp;token=7aeea75d-21e8-48d8-aa1a-5783d83ccba3" alt=""><figcaption></figcaption></figure></div>

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

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FcfuSmh29BRxphU6DAvdY%2Fadd%20last%20word%20transform%203.png?alt=media&amp;token=c4341b4e-adc7-4782-961b-b84058f9cd3a" alt=""><figcaption></figcaption></figure></div>

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

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FBYtoSiGhId5mTYWY3ani%2Fadd%20last%20word%20transform%204.png?alt=media&amp;token=fccef3ed-8649-47ff-b67b-5e6aae0d0e14" alt=""><figcaption></figcaption></figure></div>

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

<figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F3XPCy1jxb3htXubyedNz%2Fadd%20last%20word%20transform%205.png?alt=media&amp;token=9dc9abe6-dd4a-4a7e-80eb-fb286eedc148" 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="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2Fk8HUaAcgdEk1RBgJ8eHc%2Fadd%20last%20word%20transform%206.png?alt=media&amp;token=2a0471ad-3535-4315-abbf-c1f3b418093c" 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="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FlUqgyX2cyzktg1rQaRJg%2Fadd%20last%20word%20transform%207.png?alt=media&amp;token=1765236a-262d-4438-bd94-428f6b3e7da6" alt=""><figcaption></figcaption></figure></div>

**Step 8**\
Accept your changes:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2Fmep6edmYWIn274lFKxOO%2Fadd%20last%20word%20transform%208.png?alt=media&amp;token=d6f00c05-4421-458b-9bc3-fc86788cc42c" alt=""><figcaption></figcaption></figure></div>

**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="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F9JuI5rl5CYY3HsdYHJ0q%2Fadd%20last%20word%20transform%209.png?alt=media&amp;token=1ca96575-c365-4a55-acb1-0f4fde93d592" alt=""><figcaption></figcaption></figure></div>
