get length of string in UTF8
<p>How can I get the length (not number of bytes) of a string in its UTF-8 encoded form (PHP's <code>mb_strlen(.., 'UTF-8')</code> equivalent)?</p>

<p>I tried <code>string.characters.count</code> but it does not return the correct length for certain characters like an emoji.</p>

<p>Example:</p>

<pre><code>let s = "✌️"
print(s.characters.count) // prints 2, but should print 3.
</code></pre>