Options
All
  • Public
  • Public/Protected
  • All
Menu

Module background/methods/dataTypes/strings

Index

Functions

  • deleteSpaces(string: string): string
  • This function takes a string and returns a string with all spaces removed.

    Parameters

    • string: string

      The string to be modified.

    Returns string

    A string with all spaces removed.

  • reverseString(string: string): string
  • If the string is empty, return an empty string, otherwise return the reverse of the string

    Parameters

    • string: string

      the string to reverse

    Returns string

    The last character of the string is being returned first, followed by the second to last character, and so on.

  • stringReplaceSubstringOneTimeFromBeginningAndEnd(string: string, substring: string, replaceWith: string): string
  • Replace a substring in a string, but only once, from the beginning and end of the string.

    example
    // returns "Muad'DibPaulAtreidesPaulMuad'Dib"
    let newString = stringReplaceSubstringOneTimeFromBeginningAndEnd("PaulPaulAtreidesPaulPaul","Paul","Muad'Dib");

    Parameters

    • string: string

      The string to be modified.

    • substring: string

      The substring to replace.

    • replaceWith: string

      The string to replace the substring with.

    Returns string

    The string with the first and last instances of the substring replaced with the replaceWith string.

  • trimString(string: string, maxLength: number): string
  • If the string is longer than the maxLength, return a substring of the string, otherwise return the string.

    Parameters

    • string: string

      The string to trim.

    • maxLength: number

      The maximum length of the string.

    Returns string

    string or shortened string

  • trimStringWithDotsAtEnd(string: string, maxLength: number): string
  • It takes a string and a maximum length, and returns a string that is at most the maximum length, with an ellipsis at the end if the string was longer than the maximum length

    Parameters

    • string: string

      The string to trim.

    • maxLength: number

      The maximum length of the string.

    Returns string

    A string with an ellipsis at the end.

Generated using TypeDoc version 0.22.15, the 4/20/2022