4 ms·
Unsurprising that (at least some implementation of) Swift does the least wrong thing in returning 1. I think it's also one of the few languages that will return
by Jach 3y ago
Unsurprising that (at least some implementation of) Swift does the least wrong thing in returning 1. I think it's also one of the few languages that will return a count of 1 for the madness that is country flag emojis https://docs.swift.org/swift-book/documentation/the-swift-programming-language/stringsandcharacters#Extended-Grapheme-Clusters https://docs.swift.org/swift-book/documentation/the-swift-pr...
- ant6n 3y ago“Least wrong” sounds very silly. Its like programmers are discovering theres a difference between bytes, unicode code points and grapheme clusters and are unsure about how their favorite programming language represents strings, and then decide there should be some behavior that doesnt follow from the documentation. The “length of an emoji” depends on the data type used to represent it. Its that simple and that correct.
- baq 3y ago'least wrong length method' for strings is not providing one in the first place.