Options
All
  • Public
  • Public/Protected
  • All
Menu

For creating, loading, and saving terminal character sets.

string based constructor

String of characters that will be converted to a set. No separator characters.

const example: CharacterSet = new CharacterSet(' .:-=+*#%@');

number[] based constructor

Use a set that has already been converted to UTF-16.

const example: CharacterSet = new CharacterSet([32, 46, 58, 45, 61, 43, 42, 35, 37, 64]);

Unknown Characters

Characters which are not in the set will be displayed using the unknown character code. By default this is '�' or the unicode replacement character. Be advised that the replacement character doesn't always displayed with the correct spacing for a monospaced font and can lead to undesirable results. If you intend to use this functionality then you can set the value of unknown manually or using the constructor.

Notes:

  • In some cases order matters, so keep that in mind.
  • You must include a space (32 in UTF-16) in the constructor for it to be included in the set.

Hierarchy

  • CharacterSet

Index

Constructors

constructor

  • new CharacterSet(characters?: undefined | string, unknown?: string | number): CharacterSet
  • new CharacterSet(set?: number[], unknown?: string | number): CharacterSet

Properties

set

set: number[]

A set of characters stored as UTF-16 numbers.

unknown

unknown: number

A number representing the UTF-16 code of the character to use if not in set.

Methods

getIndex

  • getIndex(character: string): number
  • Get index in set based on character. -1 if not in set.

    Parameters

    • character: string

    Returns number

    index or -1

getValue

  • getValue(index: number): number

size

  • size(): number

toString

  • toString(index: number): string

Static getDefaultCharacterSet

  • getDefaultCharacterSet(): number[]

Generated using TypeDoc