Charset

A Charset object represents a set of Unicode characters that can be used with Scanner objects to parse strings for specific ranges of a string that match the characters in the charset.

The Charset class is not subclassable.

Class Methods

constructor([string])

Creates a new Charset object that contains all of the characters present in the provided string (or, if no string is provided, no characters).

Class Properties

alphanumeric

The character set containing all alphanumeric characters, as defined in Unicode General Category L, M, and N*.

digits

The character set containing all decimal digit characters, as defined in Unicode Category Decimal Numbers.

letters

The character set containing all letter characters, as defined in Unicode General Category L* & M*.

lower

The character set containing all lowercase letter characters, as defined in Unicode General Category Ll.

newlines

The character set containing all newline characters (U+000A ~ U+000D, U+0085, U+2028, and U+2029).

symbols

The character set containing all symbol characters, as defined in Unicode General Category S*.

upper

The character set containing all uppercase letter characters, as defined in Unicode General Category Lu and Lt.

whitespace

The character set containing all whitespace characters, as defined in Unicode General Category Zs and CHARACTER TABULATION (U+0009).

whitespaceAndNewlines

The character set containing all whitespace and newline characters, as defined in Unicode General Category Z*, U+000A ~ U+000D, and U+0085.

Methods

concat(charset[, …])

Returns a new character set that concatenates all characters in the receiver as well as any other charsets provided as arguments.

intersect(charset)

Returns a new character set that forms an intersection of the receiver as well as any other charsets provided as arguments.

invert()

Returns a new character set that represents the inverse of the receiver.