Strip whitespace from a string/Top and tail: Difference between revisions

→‎{{header|Kotlin}}: Note about predicate
(→‎{{header|Java}}: Rework a tiny bit. Remove raw `trim`. Add some help text.)
(→‎{{header|Kotlin}}: Note about predicate)
Line 1,251:
 
=={{header|Kotlin}}==
It is worth poitingpointing out that Kotlin, unlike Java, has <code>String.trimStart</code> and <code>String.trimEnd</code>. More importantly though, Kotlin’s <code>String.trim</code> actually trims whitespace as defined by Unicode, whereas Java’s just strips Unicode control characters.
 
Kotlin’s <code>trim</code> family of functions also optionally accept a predicate, which can further customize the stripping behavior, if Unicode whitespace is not what is desired.
 
<lang kotlin>fun main(args: Array<String>) {