Options
All
  • Public
  • Public/Protected
  • All
Menu

Helper Class for Strings

Hierarchy

  • StringUtil

Index

Constructors

constructor

Methods

Static coerce

  • coerce(str: string): any
  • This coerces the value of a string by casting it to the most plausible datatype, guessed by the value itself.

    Parameters

    • str: string

      The input string to coerce.

    Returns any

    The coerced value.

Static sanitizeUrl

  • sanitizeUrl(url: string): string
  • Removes duplicated forward slashes as well as trailing slash and returns normalized URL string.

    Parameters

    • url: string

      Original URL string.

    Returns string

    Sanitized URL string.

Static stringDivider

  • stringDivider(str: string, width: number, spaceReplacer: string): string

Static stripHTMLTags

  • stripHTMLTags(htmlString: string): string
  • Returns the displayed text of an string with html text.

    Parameters

    • htmlString: string

      A string containing html.

    Returns string

    The stripped Text.

Static urlify

  • urlify(text: string): string
  • Replaces any occurrence of a link-like text with an <a>-tag.

    Parameters

    • text: string

      The string context to replace.

    Returns string

    The urlified string.

Generated using TypeDoc