`String.prototype.symbolAt()` (improved `String.prototype.charAt()`)
Anne van Kesteren
annevk at annevk.nl
Fri Oct 18 08:48:24 PDT 2013
On Fri, Oct 18, 2013 at 1:46 PM, Mathias Bynens <mathias at qiwi.be> wrote:
> Similarly, `String.prototype.charCodeAt` is fixed by `String.prototype.codePointAt`.
When you phrase it like that, I see another problem with
codePointAt(). You can't just replace existing usage of charCodeAt()
with codePointAt() as that would fail for input with paired
surrogates. E.g. a simple loop over a string that prints code points
would print both the code point and the trail surrogate code point for
a surrogate pair.
The same goes for this new method. I still think that only offering a
better way to iterate strings (as planned) seems like a much safer
start into this brave new code point-based world.
More information about the es-discuss