

> The String class in the Java JVM uses UTF-16 encoding. > length to not match the actual number of characters in the string. > less commonly-used characters, so it's possible for the value returned by
#Java string to codepoints code
> represent the most common characters, but needs to use two code units for > string format used by JavaScript, uses a single 16-bit code unit to > This property returns the number of code units in the string. > number of codePoints of the string to reflect the actual number of

> I expect to be able to add an attribute to String.prototype that returns the On Thursday, Aug4:37:07 AM CEST fanerge wrote: I sincerely hope that you can accept my proposal, thanks. I believe that most developers need such a method and property to get the number of codePoints in a string. For example: can return the actual number of codePoints instead of code unit. I want the ECMA organization to be able to add a property or method to String.prototype that returns the value of the codePoint of the string. dePointCount(): The method returns the number of codewords in the string. String.length(): The method returns the number of characters in char in the string The String class in the Java JVM uses UTF-16 encoding. UTF-16, the string format used by JavaScript, uses a single 16-bit code unit to represent the most common characters, but needs to use two code units for less commonly-used characters, so it's possible for the value returned by length to not match the actual number of characters in the string. This property returns the number of code units in the string. I expect to be able to add an attribute to String.prototype that returns the number of codePoints of the string to reflect the actual number of characters instead of the code unit.
