SLN SLN - 1 year ago 77
Swift Question

What's the different between CharacterView and UnicodeScalarView of the String type

The following two code practically did the same thing

for character in "Dog!

Answer Source

This comes down to the difference between a Character and UnicodeScalar.

Unicode Scalars

Behind the scenes, Swift’s native String type is built from Unicode scalar values. A Unicode scalar is a unique 21-bit number for a character or modifier, such as U+0061 for LATIN SMALL LETTER A ("a"), or U+1F425 for FRONT-FACING BABY CHICK ("

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download