-
Intl.StringInfo
.charCodes(s)
- Returns anIterable
that yields each code unit within the strings
..codePoints(s)
- Returns anIterable
that yields each code point within the strings
(essentially justyield* s
)..graphemeClusters(s)
- Returns anIterable
that yields each grapheme cluster substring within the strings
..codePointCount(s)
- Counts the number of code points within the strings
..graphemeClusterCount(s)
- Counts the number of grapheme clusters within the strings
..nthCodePoint(s, n)
- Gets then
-th code point (as a number) within the strings
..nthGraphemeCluster(s, n)
- Gets then
-th grapheme cluster (as a substring) within the strings
..codePointSize(codePoint)
- Gets the size, in code units, of the provided code point..getUnicodeCategory(s, i)
- Gets the unicode category for the code point at the specified indexi
in strings
..isControl(s, i)
- Returnstrue
if the code point at the specified indexi
in strings
is a control character..isDigit(s, i)
- Returnstrue
if the code point at the specified indexi
in strings
is a decimal digit..isNumber(s, i)
- Returnstrue
if the code point at the specified indexi
in strings
is a unicode number character..isLetter(s, i)
- Returnstrue
if the code point at the specified indexi
in strings
is a unicode letter character..isPunctuation(s, i)
- Returnstrue
if the code point at the specified indexi
in strings
is a unicode punctuation character..isSeparator(s, i)
- Returnstrue
if the code point at the specified indexi
in strings
is a unicode separator character..isSymbol(s, i)
- Returnstrue
if the code point at the specified indexi
in strings
is a unicode symbol character..isWhitespace(s, i)
- Returnstrue
if the code point at the specified indexi
in strings
is a unicode whitespace character..isLowSurrogate(s, i)
- Returnstrue
if the code point at the specified indexi
in strings
is a low surrogate code unit..isHighSurrogate(s, i)
- Returnstrue
if the code point at the specified indexi
in strings
is a high surrogate code unit..isSurrogatePair(s, i)
- Returnstrue
if the next two code points at the specified indexi
in strings
form a surrogate pair..isUpperCase(s, i)
- Returnstrue
if the code point at the specified indexi
in strings
is a unicode upper-case character..isLowerCase(s, i)
- Returnstrue
if the code point at the specified indexi
in strings
is a unicode lower-case character.
-
String.prototype
:.codePointCount()
- Counts the number of code points within the strings
..nthCodePoint(n)
- Gets then
-th code point (as a number) within the strings
.
Created
September 22, 2020 03:09
-
-
Save rbuckton/cc14f0ff97cf420f474996fee2f78a13 to your computer and use it in GitHub Desktop.
Rough design for improving the native API for strings in ECMAScript
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I also hope we can have some methods which just codepoint-safe but still codeunit-based index (for O(1) performance):
String.prototype.uItem(i)
- behave likeitem(i)
but return length 2 string if it's surrogate pair, anduItem(i+1)
return empty string.String.protoype.uSlice()
- behave likeslice()
but use similar semantic ofuItem
for surrogate pair.