Options
All
  • Public
  • Public/Protected
  • All
Menu

A couple of utility methods for working with strings.

since

1.0

Hierarchy

  • StringUtils

Index

Properties

Static EMPTY

EMPTY: string = ""

Value of the empty String

Static STRING_TYPE

STRING_TYPE: string = "string"

Value of the String type (as returned by typeof operator)

Static WHITE_SPACE

WHITE_SPACE: string = ""

Value of the white space String

Methods

Static isBlank

  • isBlank(str: string): boolean
  • Checks if a String is whitespace, empty ("") or null.

    StringUtils.isEmpty(null)      = true
    StringUtils.isEmpty("")        = true
    StringUtils.isEmpty(" ")       = true
    StringUtils.isEmpty("bob")     = false
    StringUtils.isEmpty("  bob  ") = false
    since

    1.0

    Parameters

    • str: string

      the String to check, may be null

    Returns boolean

    true if the String is null, empty or whitespace

Static isEmpty

  • isEmpty(str: string): boolean
  • Checks if a String is whitespace, empty ("") or null.

    StringUtils.isEmpty(null)      = true
    StringUtils.isEmpty("")        = true
    StringUtils.isEmpty(" ")       = false
    StringUtils.isEmpty("bob")     = false
    StringUtils.isEmpty("  bob  ") = false
    since

    1.0

    Parameters

    • str: string

      the String to check, may be null

    Returns boolean

    true if the String is empty or null

Static isNotBlank

  • isNotBlank(str: string): boolean
  • Checks if a String is not empty (""), not null and not whitespace only.

    StringUtils.isEmpty(null)      = false
    StringUtils.isEmpty("")        = false
    StringUtils.isEmpty(" ")       = false
    StringUtils.isEmpty("bob")     = true
    StringUtils.isEmpty("  bob  ") = true
    since

    1.0

    Parameters

    • str: string

      the String to check, may be null

    Returns boolean

    true if the String is not empty and not null and not whitespace

Static isNotEmpty

  • isNotEmpty(str: string): boolean
  • Checks if a String is not empty ("") and not null.

    StringUtils.isEmpty(null)      = false
    StringUtils.isEmpty("")        = false
    StringUtils.isEmpty(" ")       = true
    StringUtils.isEmpty("bob")     = true
    StringUtils.isEmpty("  bob  ") = true
    since

    1.0

    Parameters

    • str: string

      the String to check, may be null

    Returns boolean

    true if the String is not empty and not null