# 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://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FxDp04KQZqdVNpnqVCPSq%2F0.png?alt=media)

**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://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FOWcgRZgEjBEnpY1TEf1F%2F1.png?alt=media)

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://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2F1sXwtj190sHCdlhMfuqF%2F2.png?alt=media)
