You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Activity
jasongin commentedon Apr 6, 2017
Most of the time what you want is the length of the utf8 or utf16 encoding:
value.Utf8Value().size()orvalue.Utf16Value().size().Maybe there should be a
Napi::String::Length()method that callsnapi_get_value_string_length()to get the character length. Or maybe we should removenapi_get_value_string_length(), since it's not very useful and a potential source of localization bugs if it is used incorrectly.jasongin commentedon Apr 14, 2017
See nodejs/abi-stable-node#226 about removing
napi_get_value_string_length().jasongin commentedon Apr 27, 2017
Closing because
napi_get_value_string_length()was removed in nodejs/node#12496