formatPath

fun formatPath(template: String, args: List<String>): String

Replaces each {} placeholder in the template string with the URL-encoded form of the corresponding list element.

For example:

    formatPath("/foo/{}/bar/{}", listOf("hello world", "a/b"))

returns the string "/foo/hello%20world/bar/a%2Fb"

Throws

if the number of placeholders does not match the size of the list.


fun formatPath(template: String, vararg args: String): String

Replaces each {} placeholder in the template string with the URL-encoded form of the corresponding additional argument.

For example:

    formatPath("/foo/{}/bar/{}", "hello world", "a/b")

returns the string "/foo/hello%20world/bar/a%2Fb"

Throws

if the number of placeholders does not match the number of additional arguments.