URLEncode

Converts a string into a URL-safe version by substituting invalid characters with their valid equivalents.

Text converted using this function can be reverted to its original state using the URLDecode function.

Syntax

URLEncode( StringValue );

Parameters

Parameter Name Type Description Optional? Default Value
StringValue String The string to encode. No n/a

Output

A string consisting of the converted text.

Use Case

A blog platform dynamically generates a URL for each new post, based on the post's title. Any title is likely to include spaces or other characters that are not suitable for URLs, so the platform uses the following expression to convert each title into something valid:

BlogURL:= URLEncode( BlogTitle );

In one example, the following string is passed to the function via the BlogTitle keyword:

My Bed + Breakfast Experience

The result of the function call, which is assigned to the BlogURL keyword, is as follows:

My+Bed+%2b+Breakfast+Experience

As you can see, all spaces have been converted to plus symbols, while the original plus symbol has been converted to the equivalent sub-string %2b.