-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
_.size to return symbol count of strings. #2302
Comments
I'm not sure what you're looking to count with this function. I recently read about combining characters and character width, and a few examples are pretty convincing. It's impossible to count the number of symbols, summing character widths is pointless, number of code points depends on the unicode normalisation form, byte count is derived from |
Based on my example, I imagine: _.size(string) === _.toArray(string).length;
Unless you want to truncate, or produce some slice/substring. |
@michaelficarra on a related note following up on your link I added added support for regional indicator symbols [..."🇺🇸"] // => ["🇺", "🇸"]
_.toArray("🇺🇸") // => ["🇺🇸"] added support for zero-width-joiners |
👍 |
Continuing the discussion, at the moment:
Since
str.length
is trivial I think it --may-- be handy if_.size
returned the number of symbols in a string instead.The text was updated successfully, but these errors were encountered: