Re:TIL the assumption that string length does not change whe...
by 3np on Monday November 22, 2021 @06:22AM
(#29305218)
I’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.
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)
Re:TIL the assumption that string length does not change whe...
by JohnHaugeland on Monday November 22, 2021 @12:00PM
(#29308625)
> 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
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)