-
Intl.StringInfo.charCodes(s)- Returns anIterablethat yields each code unit within the strings..codePoints(s)- Returns anIterablethat yields each code point within the strings(essentially justyield* s)..graphemeClusters(s)- Returns anIterablethat 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 indexiin strings..isControl(s, i)- Returnstrueif the code point at the specified indexiin stringsis a control character..isDigit(s, i)- Returnstrueif the code point at the specified indexiin stringsis a decimal digit..isNumber(s, i)- Returnstrueif the code point at the specified indexiin stringsis a unicode number character..isLetter(s, i)- Returnstrueif the code point at the specified indexiin stringsis a unicode letter character..isPunctuation(s, i)- Returnstrueif the code point at the specified indexiin stringsis a unicode punctuation character..isSeparator(s, i)- Returnstrueif the code point at the specified indexiin stringsis a unicode separator character..isSymbol(s, i)- Returnstrueif the code point at the specified indexiin stringsis a unicode symbol character..isWhitespace(s, i)- Returnstrueif the code point at the specified indexiin stringsis a unicode whitespace character..isLowSurrogate(s, i)- Returnstrueif the code point at the specified indexiin stringsis a low surrogate code unit..isHighSurrogate(s, i)- Returnstrueif the code point at the specified indexiin stringsis a high surrogate code unit..isSurrogatePair(s, i)- Returnstrueif the next two code points at the specified indexiin stringsform a surrogate pair..isUpperCase(s, i)- Returnstrueif the code point at the specified indexiin stringsis a unicode upper-case character..isLowerCase(s, i)- Returnstrueif the code point at the specified indexiin stringsis 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 ofuItemfor surrogate pair.