How do I replace duplicate whitespaces in a String in Kotlin?
<p>Say I have a string: <code>"Test    me"</code>.</p>

<p>how do I convert it to: <code>"Test me"</code>?</p>

<p>I've tried using:</p>

<pre><code>string?.replace("\\s+", " ")
</code></pre>

<p>but it appears that <code>\\s</code> is an illegal escape in Kotlin.</p>