# UrlEncode

| **Name**    | ***UrlEncode***                                                                    |
| ----------- | ---------------------------------------------------------------------------------- |
| Syntax      | UrlEncode (String str)                                                             |
| Purpose     | To return an escaped string.                                                       |
| Description | Returns a string by replacing invalid characters with valid ones for use in a URL. |
| Return Type | String                                                                             |
| Parameter   | str \[System.String] – The raw string to encode                                    |

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/OnwQ7DLfezh6rBZFUeNO/0.png)

**Example**

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

Where,

*str =* <http://www.helloWorld.com/ABC-123/ABC123>

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/XP6O48l101Vi4D97a2dl/1.png)

Right-click on the function transformation object and select *Preview Output.* You can see that Astera has returned the escaped URL value.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/zIQRgS5lDr6xO2yrjBbn/2.png)
