trimEnds

fun String.trimEnds(len: Int = 1): String

Trims whitespace and removes len characters from both ends of this String.

Return

the trimmed substring

Parameters

len

the number of characters to remove from each end (default 1)

Throws

if len is negative or the trimmed string is shorter than 2 * len.