CharMatcher

Methods
3
Fields
None

Getting one

Text.JAGEX_PRINTABLE_CHAR_MATCHER

Methods

MethodReturnsDescription
retainFrom(string)stringThe characters of sequence the matcher matches, in order: Text.JAGEX_PRINTABLE_CHAR_MATCHER:retainFrom(s) keeps what the game's fonts d…
removeFrom(string)stringThe characters of sequence the matcher does not match, in order.
matchesCharacter(string)booleanWhether the matcher matches the character c, a one-character string (Luau has no char), as utf8.char(code) or a utf8.codes walk giv…

Method details

retainFrom

retainFrom: (CharMatcher, string) -> string

The characters of sequence the matcher matches, in order: Text.JAGEX_PRINTABLE_CHAR_MATCHER:retainFrom(s) keeps what the game's fonts draw (U+0020-U+007E, U+0080, U+00A0-U+00FF).

removeFrom

removeFrom: (CharMatcher, string) -> string

The characters of sequence the matcher does not match, in order.

matchesCharacter

matchesCharacter: (CharMatcher, string) -> boolean

Whether the matcher matches the character c, a one-character string (Luau has no char), as utf8.char(code) or a utf8.codes walk gives it, or string.sub(s, i, i) on ASCII text (past ASCII it is one byte of a character, and raises as not UTF-8). Raises for a string that is not exactly one UTF-16 unit (empty, longer, or one character above U+FFFF).