Options
All
  • Public
  • Public/Protected
  • All
Menu

Class StringTools

Helper to manipulate strings

Hierarchy

  • StringTools

Index

Methods

Static DecodeSearch playground for Decode

  • Decode(buffer: Uint8Array | Uint16Array): string
  • Decodes a buffer into a string

    Parameters

    • buffer: Uint8Array | Uint16Array

      The buffer to decode

    Returns string

    The decoded string

Static DecodeBase64ToBinarySearch playground for DecodeBase64ToBinary

  • DecodeBase64ToBinary(base64Data: string): ArrayBuffer
  • Converts a given base64 string into an ArrayBuffer of raw byte data

    Parameters

    • base64Data: string

      The base64 encoded string to decode

    Returns ArrayBuffer

    ArrayBuffer of byte data

Static DecodeBase64ToStringSearch playground for DecodeBase64ToString

  • DecodeBase64ToString(base64Data: string): string
  • Converts a given base64 string as an ASCII encoded stream of data

    Parameters

    • base64Data: string

      The base64 encoded string to decode

    Returns string

    Decoded ASCII string

Static EncodeArrayBufferToBase64Search playground for EncodeArrayBufferToBase64

  • EncodeArrayBufferToBase64(buffer: ArrayBuffer | ArrayBufferView): string
  • Encode a buffer to a base64 string

    Parameters

    • buffer: ArrayBuffer | ArrayBufferView

      defines the buffer to encode

    Returns string

    the encoded string

Static EndsWithSearch playground for EndsWith

  • EndsWith(str: string, suffix: string): boolean
  • Checks for a matching suffix at the end of a string (for ES5 and lower)

    Parameters

    • str: string

      Source string

    • suffix: string

      Suffix to search for in the source string

    Returns boolean

    Boolean indicating whether the suffix was found (true) or not (false)

Static PadNumberSearch playground for PadNumber

  • PadNumber(num: number, length: number): string
  • Converts a number to string and pads with preceding zeroes until it is of specified length.

    Parameters

    • num: number

      the number to convert and pad

    • length: number

      the expected length of the string

    Returns string

    the padded string

Static StartsWithSearch playground for StartsWith

  • StartsWith(str: string, suffix: string): boolean
  • Checks for a matching suffix at the beginning of a string (for ES5 and lower)

    Parameters

    • str: string

      Source string

    • suffix: string

      Suffix to search for in the source string

    Returns boolean

    Boolean indicating whether the suffix was found (true) or not (false)

Legend

  • Constructor
  • Property
  • Method
  • Property
  • Method
  • Inherited property
  • Inherited method
  • Static property
  • Static method