Options
All
  • Public
  • Public/Protected
  • All
Menu
     

Interface String

Hierarchy

  • String

Index

Properties

len

len: number

The real-character length of the string.

hideCnt

hideCnt: number

The hidden-character length of the string.

lines

lines: number

The amount of lines in this string.

Methods

coalesceMatch

  • coalesceMatch(regexp: RegExp, backup?: string[]): string[]
  • Like String.match, retrieves the result of matching a string against a regular expression, but receieves a "backup" Array to return if there is no match.

    Parameters

    • regexp: RegExp

      A regular expression object. If a non-RegExp object obj is passed, it is implicitly converted to a RegExp by using new RegExp(obj).

    • Optional backup: string[]

      A "backup" Array of String(s) that will return in the event of no-match.

    Returns string[]

    An Array whose contents depend on the presence or absence of the global (g) flag; or the "backup" Array, if no matches are found.

distinct

  • distinct(...vals: string[]): string
  • De-duplicates repeated phrases as specified by the arguments.

    Parameters

    • Rest ...vals: string[]

      A list of phrases to de-duplicate

    Returns string

colored

  • colored(opts: any): string
  • Colors phreases within the string.

    Parameters

    • opts: any

    Returns string

inColor

  • inColor(lft: string, rgt: string): string
  • ???

    Parameters

    • lft: string

      ???

    • rgt: string

      ???

    Returns string

appears

  • appears(char: string): number
  • Counts the appearance of a phrase in this string.

    Parameters

    • char: string

      The phrase to count.

    Returns number

has

  • has(text: string): boolean
  • Determines if the string has a phrase.

    Parameters

    • text: string

      The phrase to look for.

    Returns boolean

dup

  • dup(amount: number): string
  • Duplicates the string by the specified amount.

    Parameters

    • amount: number

      The amount of times to duplicate the string.

    Returns string

indent

  • indent(count: number, chr: string, from?: number): string
  • Indents each line within the string.

    Parameters

    • count: number

      The amount of indents.

    • chr: string

      The indent character.

    • Optional from: number

      An optional line number to start from.

    Returns string

pad

  • pad(pad: string, amount: number, direct?: PadDir, log?: boolean): string
  • Adds padding to the string.

    Parameters

    • pad: string

      The padding character.

    • amount: number

      The amount of padding.

    • Optional direct: PadDir

      The direction of the padding.

    • Optional log: boolean

      If true; prints out debugging logs.

    Returns string

toSentenceCase

  • toSentenceCase(): string
  • Converts the string to sentence-case.

    Returns string

toTitleCase

  • toTitleCase(): string
  • Converts the string to title-case.

    Returns string

format

  • format(): string
  • Formats the string using DCT options.

    Returns string

align

  • align(delim: string, direction: PadDir): string
  • Aligns the string by left ("-"), right ("+"), or centered ("").

    Parameters

    • delim: string

      The delimiter used to separate the values.

    • direction: PadDir

      The direction to align towards.

    Returns string

toLines

  • toLines(): string[]
  • Converts the lines of this string to a list of lines.

    Returns string[]

toColumns

  • toColumns(options: __type): string
  • Formats a delimited string into an aligned table.

    Parameters

    • options: __type

      CLMS options.

    Returns string