Klasse StringUtils

java.lang.Object
org.iqtig.packer.shared.error.crypto.StringUtils

public class StringUtils extends Object
Clone from org.apache.commons:commons-lang3:3.11.
Autor:
matthias.drummer
  • Feldübersicht

    Felder
    Modifizierer und Typ
    Feld
    Beschreibung
    static final String
    The empty String "".
  • Methodenübersicht

    Modifizierer und Typ
    Methode
    Beschreibung
    static String
    Returns either the passed in String, or if the String is null, an empty String ("").
    static String
    defaultString(String str, String defaultStr)
    Returns either the passed in String, or if the String is null, the value of defaultStr.
    static boolean
    Checks if a CharSequence is empty (""), null or whitespace only.
    static String
    join(Iterable<?> iterable, String separator)
    Joins the elements of the provided Iterable into a single String containing the provided elements.
    static String
    join(Object[] array, String separator)
    Joins the elements of the provided array into a single String containing the provided list of elements.
    static String
    join(Object[] array, String separator, int startIndex, int endIndex)
    Joins the elements of the provided array into a single String containing the provided list of elements.
    static String
    join(Iterator<?> iterator, String separator)
    Joins the elements of the provided Iterator into a single String containing the provided elements.
    static int
    Gets a CharSequence length or 0 if the CharSequence is null.

    Von Klasse geerbte Methoden java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Felddetails

  • Methodendetails

    • defaultString

      public static String defaultString(String str)

      Returns either the passed in String, or if the String is null, an empty String ("").

       StringUtils.defaultString(null)  = ""
       StringUtils.defaultString("")    = ""
       StringUtils.defaultString("bat") = "bat"
       
      Parameter:
      str - the String to check, may be null
      Gibt zurück:
      the passed in String, or the empty String if it was null
      Siehe auch:
    • defaultString

      public static String defaultString(String str, String defaultStr)

      Returns either the passed in String, or if the String is null, the value of defaultStr.

       StringUtils.defaultString(null, "NULL")  = "NULL"
       StringUtils.defaultString("", "NULL")    = ""
       StringUtils.defaultString("bat", "NULL") = "bat"
       
      Parameter:
      str - the String to check, may be null
      defaultStr - the default String to return if the input is null, may be null
      Gibt zurück:
      the passed in String, or the default if it was null
      Siehe auch:
    • join

      public static String join(Iterable<?> iterable, String separator)

      Joins the elements of the provided Iterable into a single String containing the provided elements.

      No delimiter is added before or after the list. A null separator is the same as an empty String ("").

      See the examples here: join(Object[], String).

      Parameter:
      iterable - the Iterable providing the values to join together, may be null
      separator - the separator character to use, null treated as ""
      Gibt zurück:
      the joined String, null if null iterator input
      Seit:
      2.3
    • join

      public static String join(Iterator<?> iterator, String separator)

      Joins the elements of the provided Iterator into a single String containing the provided elements.

      No delimiter is added before or after the list. A null separator is the same as an empty String ("").

      See the examples here: join(Object[], String).

      Parameter:
      iterator - the Iterator of values to join together, may be null
      separator - the separator character to use, null treated as ""
      Gibt zurück:
      the joined String, null if null iterator input
    • join

      public static String join(Object[] array, String separator)

      Joins the elements of the provided array into a single String containing the provided list of elements.

      No delimiter is added before or after the list. A null separator is the same as an empty String (""). Null objects or empty strings within the array are represented by empty strings.

       StringUtils.join(null, *)                = null
       StringUtils.join([], *)                  = ""
       StringUtils.join([null], *)              = ""
       StringUtils.join(["a", "b", "c"], "--")  = "a--b--c"
       StringUtils.join(["a", "b", "c"], null)  = "abc"
       StringUtils.join(["a", "b", "c"], "")    = "abc"
       StringUtils.join([null, "", "a"], ',')   = ",,a"
       
      Parameter:
      array - the array of values to join together, may be null
      separator - the separator character to use, null treated as ""
      Gibt zurück:
      the joined String, null if null array input
    • join

      public static String join(Object[] array, String separator, int startIndex, int endIndex)

      Joins the elements of the provided array into a single String containing the provided list of elements.

      No delimiter is added before or after the list. A null separator is the same as an empty String (""). Null objects or empty strings within the array are represented by empty strings.

       StringUtils.join(null, *, *, *)                = null
       StringUtils.join([], *, *, *)                  = ""
       StringUtils.join([null], *, *, *)              = ""
       StringUtils.join(["a", "b", "c"], "--", 0, 3)  = "a--b--c"
       StringUtils.join(["a", "b", "c"], "--", 1, 3)  = "b--c"
       StringUtils.join(["a", "b", "c"], "--", 2, 3)  = "c"
       StringUtils.join(["a", "b", "c"], "--", 2, 2)  = ""
       StringUtils.join(["a", "b", "c"], null, 0, 3)  = "abc"
       StringUtils.join(["a", "b", "c"], "", 0, 3)    = "abc"
       StringUtils.join([null, "", "a"], ',', 0, 3)   = ",,a"
       
      Parameter:
      array - the array of values to join together, may be null
      separator - the separator character to use, null treated as ""
      startIndex - the first index to start joining from.
      endIndex - the index to stop joining from (exclusive).
      Gibt zurück:
      the joined String, null if null array input; or the empty string if endIndex - startIndex <= 0. The number of joined entries is given by endIndex - startIndex
      Löst aus:
      ArrayIndexOutOfBoundsException - ife
      startIndex < 0 or
      startIndex >= array.length() or
      endIndex < 0 or
      endIndex > array.length()
    • isBlank

      public static boolean isBlank(CharSequence cs)

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

      Whitespace is defined by Character.isWhitespace(char).

       StringUtils.isBlank(null)      = true
       StringUtils.isBlank("")        = true
       StringUtils.isBlank(" ")       = true
       StringUtils.isBlank("bob")     = false
       StringUtils.isBlank("  bob  ") = false
       
      Parameter:
      cs - the CharSequence to check, may be null
      Gibt zurück:
      true if the CharSequence is null, empty or whitespace only
      Seit:
      2.0, 3.0 Changed signature from isBlank(String) to isBlank(CharSequence)
    • length

      public static int length(CharSequence cs)
      Gets a CharSequence length or 0 if the CharSequence is null.
      Parameter:
      cs - a CharSequence or null
      Gibt zurück:
      CharSequence length or 0 if the CharSequence is null.
      Seit:
      2.4, 3.0 Changed signature from length(String) to length(CharSequence)