How to count the number of symbols in a string?
addison at lab126.com
Fri Nov 30 14:08:47 PST 2012
to sanitize, I would say, is the very first use case where if str.length != str.points something might require a fix.
A utf-8 friendly "number of allowed chars", as it would be the twitter case, is another example.
A split able to represent codePoints rather than chars would need points number too ... the fact developers are already asking for a way to obtain these codePoints should also indicate the feature might be needed.
I'm not saying that there is no utility at all. Just pointing out that the codepoint count doesn't represent e.g. the "number of symbols" in the string and that adding it for that purpose might not achieve the aim of someone who wants to know how many symbols will appear.
The Twitter case is an interesting one. Ditto string splitting.
More information about the es-discuss