Like String#charAt, but return the pair of UTF-16 surrogates for characters outside of BMP.
Offset to extract the character.
Optional
backwards: booleanUse backwards direction to detect UTF-16 surrogates, defaults to false.
Utility function to trim down a string, based on byteLimit
and given a safe start position.
It supports insertion anywhere in the string, so "foo" to "fobaro" if limit is 4 will result in "fobo",
not "foba". Basically emulating the native maxlength by reconstructing where the insertion occurred.
Known value that was previously returned by this function, if none, pass empty string.
New value that may have to be trimmed down.
Number of bytes the value may be in size.
Optional
filterFunction: ((val) => number)Function to call on the string before assessing the length.
Utility function to trim down a string, based on codePointLimit
and given a safe start position.
It supports insertion anywhere in the string, so "foo" to "fobaro" if limit is 4 will result in "fobo",
not "foba". Basically emulating the native maxlength by reconstructing where the insertion occurred.
Known value that was previously returned by this function, if none, pass empty string.
New value that may have to be trimmed down.
Number of characters the value may be in size.
Optional
filterFunction: ((val) => number)Function to call on the string before assessing the length.
Generated using TypeDoc
Type definitions for the methods of mw.String.
Note that the relevant object is not part of WpLibExtra (the interface is available in the npm package).