5 ms·
That makes length operation require full parsing of the text according to Unicode rules. Hope you have an up to date set of these! Codepoints is easy, as are b
by AstralStorm 5y ago
That makes length operation require full parsing of the text according to Unicode rules. Hope you have an up to date set of these!
Codepoints is easy, as are bytes. Graphemes much harder.
So, what's the length of a sole non-breaking joiner codepoint? (U+2060, yes it's allowed)
- 3np 5y agoI’m really not an expert but is there anything particular with this one? Looking here the answer looks like “0” for all contexts to me. https://codepoints.net/U+2060 https://codepoints.net/U+2060 And well, I don’t think anyone’s arguing that a “length” function needs to be exposed by the standard library of any language (I saw that Swift does btw). Besides from byte count it’s the only interpretation of “length” that I think makes sense for users (like I mentioned above, validating that a name has at least length 1, for example)
- JohnHaugeland 5y ago> And well, I don’t think anyone’s arguing that a “length” function needs to be exposed by the standard library of any language that's literally the core premise of the original post
- 3np 5y ago...is it?