string.uRLEncodedFormat()

Generates a URL-encoded string. For example, it replaces spaces with %20, and non-alphanumeric characters with equivalent hexadecimal escape sequences. Passes arbitrary strings within a URL.

string.uRLEncodedFormat( charset=string, force=boolean )

Returns: String

Argument Description
charset
string, optional

The character encoding in which the string is encoded.

force
boolean, optional

If false, then the string will not be encoded if it does not contain unsafe characters.

Examples

url_string = "https://dev.lucee.org/t/welcome-to-lucee-dev/2064";
dump(url_string.URLEncodedFormat()); // https%3A%2F%2Fdev%2Elucee%2Eorg%2Ft%2Fwelcome%2Dto%2Dlucee%2Ddev%2F2064

See also