Skip to content
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

String::Length missing #14

Closed
sampsongao opened this issue Apr 6, 2017 · 3 comments
Closed

String::Length missing #14

sampsongao opened this issue Apr 6, 2017 · 3 comments

Comments

@sampsongao
Copy link

Is there any reason why we don't have Length method for Napi::String?

@jasongin
Copy link
Member

jasongin commented Apr 6, 2017

Most of the time what you want is the length of the utf8 or utf16 encoding: value.Utf8Value().size() or value.Utf16Value().size().

Maybe there should be a Napi::String::Length() method that calls napi_get_value_string_length() to get the character length. Or maybe we should remove napi_get_value_string_length(), since it's not very useful and a potential source of localization bugs if it is used incorrectly.

@jasongin
Copy link
Member

See nodejs/abi-stable-node#226 about removing napi_get_value_string_length().

@jasongin
Copy link
Member

Closing because napi_get_value_string_length() was removed in nodejs/node#12496

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants