encodeToUrl

@JvmOverloads
fun String.encodeToUrl(charset: String = "UTF-8"): String

Translates a string into application/x-www-form-urlencoded format using a specific encoding scheme.

Example:

"https://www.google.co.nz/?gfe_rd=cr&ei=dzbFV&gws_rd=ssl#q=java".encodeToUrl()
// https%3A%2F%2Fwww.google.co.nz%2F%3Fgfe_rd%3Dcr%26ei%3DdzbFV%26gws_rd%3Dssl%23q%3Djava

Since

1.1.0

See also