org.apache.hc.core5.util

## Class TextUtils

- java.lang.Object
- - org.apache.hc.core5.util.TextUtils

-     public final class TextUtils
      extends Object

  Since:
    4.3

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static boolean` | `containsBlanks(CharSequence s)`
    `static boolean` | `isBlank(CharSequence s)` Checks if a CharSequence is empty (""), null or whitespace only.
    `static boolean` | `isEmpty(CharSequence s)` Returns true if the parameter is null or of zero length
    `static int` | `length(CharSequence cs)` Gets a CharSequence length or `0` if the CharSequence is `null`.
    `static String` | `toHexString(byte[] bytes)` Returns a hexadecimal string with lowercase letters, representing the values of the `bytes`.
    `static String` | `toLowerCase(String s)` Returns lower case representation of the given string using `Locale.ROOT`.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### isEmpty

          public static boolean isEmpty(CharSequence s)

      Returns true if the parameter is null or of zero length

    - #### isBlank

          public static boolean isBlank(CharSequence s)

      Checks if a CharSequence is empty (""), null or whitespace only.

      Whitespace is defined by `Character.isWhitespace(char)`.

           TextUtils.isBlank(null)      = true
           TextUtils.isBlank("")        = true
           TextUtils.isBlank(" ")       = true
           TextUtils.isBlank("abg")     = false
           TextUtils.isBlank("  abg  ") = false

      Parameters:
        `s` - the CharSequence to check, may be null
      Returns:
        `true` if the CharSequence is null, empty or whitespace only

    - #### length

          public static int length(CharSequence cs)

      Gets a CharSequence length or `0` if the CharSequence is `null`.
      Parameters:
        `cs` - a CharSequence or `null`
      Returns:
        CharSequence length or `0` if the CharSequence is `null`.
      Since:
        5.1

    - #### containsBlanks

          public static boolean containsBlanks(CharSequence s)

      Since:
        4.4

    - #### toHexString

          public static String toHexString(byte[] bytes)

      Returns a hexadecimal string with lowercase letters, representing the values of the `bytes`.
      Parameters:
        `bytes` - whose hex string should be created
      Returns:
        hex string for the bytes
      Since:
        5.0

    - #### toLowerCase

          public static String toLowerCase(String s)

      Returns lower case representation of the given string using `Locale.ROOT`.
      Since:
        5.2

Copyright © 2005–2021 The Apache Software Foundation. All rights reserved.