Why is
"".characters.count == 1
and not equal to 3? Is there a way to get my expected result of 3?
Why is
"".characters.count == 1
and not equal to 3? Is there a way to get my expected result of 3?
A probable cause is that Swift counts any sequence of regional indicator characters as one cluster. Your string is basically "USUSUS". But since it is displayed as three independent grapheme clusters, the count should intuitively be 3. When you put other characters between the flags, they are counted as expected.