# GetToken

| **Name**    | ***GetToken***                                                                                                                          |
| ----------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| Syntax      | GetToken (String str, String delimiter, Integer tokenIndex)                                                                             |
| Purpose     | To retrieve the specified token in a string delimited by ‘delimiter’.                                                                   |
| Description | Retrieves the specified token in a string delimited by ‘delimiter’.                                                                     |
| Return Type | String                                                                                                                                  |
| Parameters  | <p>str \[System.String] – a string</p><p>delimiter \[System.String] – Delimited string (delimiter)</p><p>tokenIndex \[System.Int32]</p> |

![](https://github.com/astera-software/Astera_Data_Stack_v9/blob/main/.gitbook/assets/0%20\(65\).png)

**Example**

In this example, we are passing the required parameters to the function transformation object using a *Variables* object.

Where,

*str* = A-B-C-D-E

*delimiter* = -

*tokenIndex* = 2

![](https://github.com/astera-software/Astera_Data_Stack_v9/blob/main/.gitbook/assets/1%20\(66\).png)

Right-click on the function transformation object and select *Preview Output.* You can see that Astera Data Stack has returned the string value, indicating the token in index position 2.

![](https://github.com/astera-software/Astera_Data_Stack_v9/blob/main/.gitbook/assets/2%20\(66\).png)
