Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • UString

Index

Constructors

constructor

  • new UString(str: string): UString

Properties

Private _charCode2CodePointIndexMap

_charCode2CodePointIndexMap: number[] = []

Private _codePoint2CharCodeIndexMap

_codePoint2CharCodeIndexMap: IndexRange[] = []

Private Optional _codePoints

_codePoints: number[]

Private _graphemeIndecies

_graphemeIndecies: IndexRange[] = []

Private _str

_str: string

Methods

Private _generateCodePoints

  • _generateCodePoints(): void

Private _generateGraphemes

  • _generateGraphemes(): void

charCodeAt

  • charCodeAt(index: number): number
  • get the char code (code uint) at the char code index. Does exactly the same thing as the JS String.charCodeAt(index)

    Parameters

    • index: number

      the char code index. [0...charCodeCount]

    Returns number

charCodeCount

  • charCodeCount(): number
  • return the count of char codes (code units of UTF-16)

    Returns number

charCodeIndex2CodePointIndex

  • charCodeIndex2CodePointIndex(index: number): number
  • convert char code index to code point index

    Parameters

    • index: number

      the char code index

    Returns number

charCodeIndex2GraphemeIndex

  • charCodeIndex2GraphemeIndex(index: number): number
  • convert char code index to grapheme index

    Parameters

    • index: number

      the char code index

    Returns number

codePointAt

  • codePointAt(index: number): number
  • Get the code point at index

    note:

    the behavior is NOT the same as JS String.codePointAt(index) which accecpts an index of the char code index.

    Parameters

    • index: number

      the code point index. Range [0...codePointCount]

    Returns number

codePointAtCharCodePoint

  • codePointAtCharCodePoint(charCodeIndex: number): number
  • Get the code point at char code index

    note:

    the behavior is NOT the same as JS String.codePointAt(index) Although they all accept a char code index, but the UString can return the correct 'surrogate paired' code point when the char code at the index is a low surrogate, which the JS String one will return the low surrogate's value.

    Parameters

    • charCodeIndex: number

      the char code index. [0...charCodeIndex]

    Returns number

codePointCount

  • codePointCount(): number
  • return the count of Unicode code points

    Returns number

codePointIndex2CharCodeIndexRange

  • codePointIndex2CharCodeIndexRange(index: number): IndexRange
  • convert code point index to char code index range

    Parameters

    • index: number

      the code point index

    Returns IndexRange

codePoints

  • codePoints(): number[]

graphemeAt

  • get the grapheme at grapheme index

    Parameters

    • index: number

      the grapheme index. [0...graphemeCount]

    Returns Grapheme

graphemeCount

  • graphemeCount(): number
  • return the count of grapheme, the grapheme boundaries are calculated from UAX #29 grapheme break algorithm.

    Returns number

graphemeIndex2CharCodeIndexRange

  • graphemeIndex2CharCodeIndexRange(index: number): IndexRange
  • convert grapheme index to char code index range

    Parameters

    • index: number

      the grapheme index

    Returns IndexRange

graphemes

sliceByCharCode

  • sliceByCharCode(start: number, to?: number): UString
  • slice the string by char code index

    Parameters

    • start: number

      start index, inclusive

    • Optional to: number

      to index, exclusive

    Returns UString

sliceByCodePoint

  • sliceByCodePoint(start: number, to?: number): UString
  • slice by code point index

    Parameters

    • start: number

      start code point index, inclusive

    • Optional to: number

      to code point, exclusive

    Returns UString

sliceByGrapheme

  • sliceByGrapheme(start: number, to?: number): UString
  • slice by grapheme index

    Parameters

    • start: number

      start grapheme index, inclusive

    • Optional to: number

      end grapheme index, exclusive

    Returns UString

toString

  • toString(): string
  • return the javascript string ( UCS-2 Encoding)

    Returns string

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc