Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface String

Extends the built-in javascript String object's prototype.

Various Format.Config methods can be called in order to access the additional definitions, see each method for more details.

Hierarchy

  • String

Index

Methods

format

  • format(...args: Object[]): string
  • format(provider: FormatProvider, ...args: Object[]): string
  • Converts the value of objects to strings based on the formats specified and inserts them into this string.

    Must call Format.Config.addFormatToPrototype to be defined.

    Parameters

    • Rest ...args: Object[]

      A list of arguments that contains zero or more objects to format.

    Returns string

    A copy of the current instance in which the format items have been replaced by the string representation of the corresponding objects in args.

  • Converts the value of objects to strings based on the formats specified and inserts them into this string.

    Must call Format.Config.addFormatToPrototype to be defined.

    Parameters

    • provider: FormatProvider

      An object that supplies culture-specific formatting information.

    • Rest ...args: Object[]

      A list of arguments that contains zero or more objects to format.

    Returns string

    A copy of the current instance in which the format items have been replaced by the string representation of the corresponding objects in args.

insert

  • insert(startIndex: number, insertValue: string): string
  • Returns a new string in which a specified string is inserted at a specified index position in the instance.

    Must call Format.Config.addUtilsToPrototype to be defined.

    Parameters

    • startIndex: number

      The zero-based index position of the insertion.

    • insertValue: string

      The string to insert.

    Returns string

    A new string that is equivalent to the instance, but with insertValue inserted at position startIndex.

padLeft

  • padLeft(totalWidth: number, paddingChar?: string): string
  • Returns a new string of a specified length in which the beginning of the current string is padded with spaces or with a specified character.

    Must call Format.Config.addPaddingToPrototype to be defined.

    Parameters

    • totalWidth: number

      The number of characters in the resulting string, equal to the number of original characters plus any additional padding characters.

    • Optional paddingChar: string

      A padding character. Defaults to Padding.Options.paddingChar.

    Returns string

padRight

  • padRight(totalWidth: number, paddingChar?: string): string
  • Returns a new string of a specified length in which the ending of the current string is padded with spaces or with a specified character.

    Must call Format.Config.addPaddingToPrototype to be defined.

    Parameters

    • totalWidth: number

      The number of characters in the resulting string, equal to the number of original characters plus any additional padding characters.

    • Optional paddingChar: string

      A padding character. Defaults to Padding.Options.paddingChar.

    Returns string

Generated using TypeDoc