Class StringHelper

java.lang.Object
com.helger.base.string.StringHelper

@Immutable public class StringHelper extends Object
Simple string utility methods, originally in StringHelper.
Since:
v12.0.0
Author:
Philip Helger
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    appendQuoted(@NonNull Appendable aTarget, @Nullable String sSource)
    Append the provided string quoted or unquoted if it is null.
    static void
    appendQuoted(@NonNull StringBuilder aTarget, @Nullable String sSource)
    Append the provided string quoted or unquoted if it is null.
    static boolean
    contains(@Nullable String sText, char cSearch)
    Check if cSearch is contained within sText.
    static boolean
    contains(@Nullable String sText, @Nullable String sSearch)
    Check if sSearch is contained within sText.
    static boolean
    containsAny(char @Nullable [] aInput, char @NonNull [] aSearchChars)
    Check if any of the passed searched characters is contained in the input char array.
    static boolean
    containsAny(@Nullable CharSequence aCS, @Nullable ICharPredicate aFilter)
    Check if the passed CharSequence contains any character matching the provided filter.
    static boolean
    containsAny(@Nullable String sInput, char @NonNull [] aSearchChars)
    Check if any of the passed searched characters in contained in the input string.
    static boolean
    containsAny(@Nullable String sStr, @Nullable ICharPredicate aFilter)
    Check if the passed String contains any character matching the provided filter.
    static boolean
    containsIgnoreCase(@Nullable String sText, char cSearch, @NonNull Locale aSortLocale)
    Check if cSearch is contained within sText ignoring case.
    static boolean
    containsIgnoreCase(@Nullable String sText, @Nullable String sSearch, @NonNull Locale aSortLocale)
    Check if sSearch is contained within sText ignoring case.
    static boolean
    containsNone(@Nullable CharSequence aCS, @Nullable ICharPredicate aFilter)
    Check if the passed CharSequence contains no character matching the provided filter.
    static boolean
    containsNone(@Nullable String sStr, @Nullable ICharPredicate aFilter)
    Check if the passed String contains no character matching the provided filter.
    static boolean
    containsOnly(@Nullable CharSequence aCS, @Nullable ICharPredicate aFilter)
    Check if the passed CharSequence contains only characters matching the provided filter.
    static boolean
    containsOnly(@Nullable String sStr, @Nullable ICharPredicate aFilter)
    Check if the passed String contains only characters matching the provided filter.
    static boolean
    endsWith(@Nullable CharSequence aCS, char c)
    Check if the passed character sequence ends with the passed character.
    static boolean
    endsWith(@Nullable CharSequence aCS, @Nullable CharSequence aSearch)
    Check if the passed character sequence ends with the passed search sequence.
    static boolean
    endsWith(@Nullable String sStr, @Nullable String sSearch)
    Check if the passed string ends with the passed search string.
    static boolean
    endsWithAny(@Nullable CharSequence aCS, char @Nullable [] aChars)
    Check if the passed character sequence ends with any of the passed characters.
    static boolean
    endsWithIgnoreCase(@Nullable CharSequence aCS, char c)
    Check if the passed character sequence ends with the passed character, ignoring case.
    static boolean
    endsWithIgnoreCase(@Nullable String sStr, @Nullable String sSearch)
    Check if the passed string ends with the passed search string, ignoring case.
    static void
    explode(char cSep, @Nullable String sElements, int nMaxItems, @NonNull Consumer<? super String> aConsumer)
    Split the provided string by the provided separator and invoke the consumer for each matched element.
    static void
    explode(char cSep, @Nullable String sElements, @NonNull Consumer<? super String> aConsumer)
    Split the provided string by the provided separator and invoke the consumer for each matched element.
    static void
    explode(@NonNull String sSep, @Nullable String sElements, int nMaxItems, @NonNull Consumer<? super String> aConsumer)
    Split the provided string by the provided separator and invoke the consumer for each matched element.
    static void
    explode(@NonNull String sSep, @Nullable String sElements, @NonNull Consumer<? super String> aConsumer)
    Split the provided string by the provided separator and invoke the consumer for each matched element.
    static @NonNull String
    getConcatenatedOnDemand(@Nullable String sFront, char cSep, @Nullable String sEnd)
    Concatenate the strings sFront and sEnd by the "cSep" separator.
    static @NonNull String
    getConcatenatedOnDemand(@Nullable String sFront, @Nullable String sEnd)
    Concatenate the strings sFront and sEnd.
    static @NonNull String
    getConcatenatedOnDemand(@Nullable String sFront, @Nullable String sSep, @Nullable String sEnd)
    Concatenate the strings sFront and sEnd by the "sSep" string.
    static @NonNull String
    getCutAfterLength(@NonNull String sValue, int nMaxLength)
    Cut the passed string after the specified length.
    static @NonNull String
    getCutAfterLength(@NonNull String sValue, int nMaxLength, @Nullable String sNewSuffix)
    Cut the passed string after the specified length, optionally appending a suffix (e.g
    static @NonNull List<String>
    getExploded(char cSep, @Nullable String sElements)
    Take a concatenated String and return a List of all elements in the passed string, using specified separator string.
    static @NonNull List<String>
    getExploded(char cSep, @Nullable String sElements, int nMaxItems)
    Take a concatenated String and return a List of all elements in the passed string, using specified separator string.
    static <COLLTYPE extends Collection<String>>
    @NonNull COLLTYPE
    getExploded(char cSep, @Nullable String sElements, int nMaxItems, @NonNull COLLTYPE aCollection)
    Take a concatenated String and return the passed Collection of all elements in the passed string, using specified separator string.
    static @NonNull List<String>
    getExploded(@NonNull String sSep, @Nullable String sElements)
    Take a concatenated String and return a List of all elements in the passed string, using specified separator string.
    static @NonNull List<String>
    getExploded(@NonNull String sSep, @Nullable String sElements, int nMaxItems)
    Take a concatenated String and return a List of all elements in the passed string, using specified separator string.
    static <COLLTYPE extends Collection<String>>
    @NonNull COLLTYPE
    getExploded(@NonNull String sSep, @Nullable String sElements, int nMaxItems, @NonNull COLLTYPE aCollection)
    Take a concatenated String and return the passed Collection of all elements in the passed string, using specified separator string.
    static @NonNull String[]
    getExplodedArray(char cSep, @Nullable String sElements)
    Take a concatenated String and return the passed String array of all elements in the passed string, using specified separator char.
    static @NonNull String[]
    getExplodedArray(char cSep, @Nullable String sElements, int nMaxItems)
    Take a concatenated String and return the passed String array of all elements in the passed string, using specified separator char.
    static @NonNull LinkedHashSet<String>
    getExplodedToOrderedSet(@NonNull String sSep, @Nullable String sElements)
    Take a concatenated String and return an ordered LinkedHashSet of all elements in the passed string, using specified separator string.
    static @NonNull HashSet<String>
    getExplodedToSet(@NonNull String sSep, @Nullable String sElements)
    Take a concatenated String and return a Set of all elements in the passed string, using specified separator string.
    static @NonNull TreeSet<String>
    getExplodedToSortedSet(@NonNull String sSep, @Nullable String sElements)
    Take a concatenated String and return a sorted TreeSet of all elements in the passed string, using specified separator string.
    static char
    getFirstChar(char @Nullable [] aChars)
    Get the first character of the passed array
    static char
    getFirstChar(@Nullable CharSequence aCS)
    Get the first character of the passed character sequence
    static @Nullable String
    getFirstToken(@Nullable String sStr, char cSearch)
    Get the first token up to (and excluding) the separating character.
    static @Nullable String
    getFirstToken(@Nullable String sStr, @Nullable String sSearch)
    Get the first token up to (and excluding) the separating string.
    static @Nullable String
    getFromFirstExcl(@Nullable String sStr, char cSearch)
    Get everything from the string from and excluding the first passed char.
    static @Nullable String
    getFromFirstExcl(@Nullable String sStr, @Nullable String sSearch)
    Get everything from the string from and excluding the passed string.
    static @Nullable String
    getFromFirstIncl(@Nullable String sStr, char cSearch)
    Get everything from the string from and including the first passed char.
    static @Nullable String
    getFromFirstIncl(@Nullable String sStr, @Nullable String sSearch)
    Get everything from the string from and including the passed string.
    static @Nullable String
    getFromLastExcl(@Nullable String sStr, char cSearch)
    Get everything from the string from and excluding the first passed char.
    static @Nullable String
    getFromLastExcl(@Nullable String sStr, @Nullable String sSearch)
    Get everything from the string from and excluding the passed string.
    static @Nullable String
    getFromLastIncl(@Nullable String sStr, char cSearch)
    Get everything from the string from and including the first passed char.
    static @Nullable String
    getFromLastIncl(@Nullable String sStr, @Nullable String sSearch)
    Get everything from the string from and including the passed string.
    static int
    getIndexOf(@Nullable String sText, char cSearch)
    Get the first index of cSearch within sText.
    static int
    getIndexOf(@Nullable String sText, int nFromIndex, char cSearch)
    Get the first index of cSearch within sText starting at index nFromIndex.
    static int
    getIndexOf(@Nullable String sText, int nFromIndex, @Nullable String sSearch)
    Get the first index of sSearch within sText starting at index nFromIndex.
    static int
    getIndexOf(@Nullable String sText, @Nullable String sSearch)
    Get the first index of sSearch within sText.
    static int
    getIndexOfIgnoreCase(@Nullable String sText, char cSearch, @NonNull Locale aSortLocale)
    Get the first index of cSearch within sText ignoring case.
    static int
    getIndexOfIgnoreCase(@Nullable String sText, int nFromIndex, char cSearch, @NonNull Locale aSortLocale)
    Get the first index of cSearch within sText ignoring case starting at index nFromIndex.
    static int
    getIndexOfIgnoreCase(@Nullable String sText, int nFromIndex, @Nullable String sSearch, @NonNull Locale aSortLocale)
    Get the first index of sSearch within sText ignoring case starting at index nFromIndex.
    static int
    getIndexOfIgnoreCase(@Nullable String sText, @Nullable String sSearch, @NonNull Locale aSortLocale)
    Get the first index of sSearch within sText ignoring case.
    static char
    getLastChar(char @Nullable [] aChars)
    Get the last character of the passed array
    static char
    getLastChar(@Nullable CharSequence aCS)
    Get the last character of the passed character sequence
    static int
    getLastIndexOf(@Nullable String sText, char cSearch)
    Get the last index of cSearch within sText.
    static int
    getLastIndexOf(@Nullable String sText, int nFromIndex, char cSearch)
    Get the last index of cSearch within sText starting at index nFromIndex.
    static int
    getLastIndexOf(@Nullable String sText, int nFromIndex, @Nullable String sSearch)
    Get the last index of sSearch within sText starting at index nFromIndex.
    static int
    getLastIndexOf(@Nullable String sText, @Nullable String sSearch)
    Get the last index of sSearch within sText.
    static int
    getLastIndexOfIgnoreCase(@Nullable String sText, char cSearch, @NonNull Locale aSortLocale)
    Get the last index of cSearch within sText ignoring case.
    static int
    getLastIndexOfIgnoreCase(@Nullable String sText, int nFromIndex, char cSearch, @NonNull Locale aSortLocale)
    Get the last index of cSearch within sText ignoring case starting at index nFromIndex.
    static int
    getLastIndexOfIgnoreCase(@Nullable String sText, int nFromIndex, @Nullable String sSearch, @NonNull Locale aSortLocale)
    Get the last index of sSearch within sText ignoring case starting at index nFromIndex.
    static int
    getLastIndexOfIgnoreCase(@Nullable String sText, @Nullable String sSearch, @NonNull Locale aSortLocale)
    Get the last index of sSearch within sText ignoring case.
    static @Nullable String
    getLastToken(@Nullable String sStr, char cSearch)
    Get the last token from (and excluding) the separating character.
    static @Nullable String
    getLastToken(@Nullable String sStr, @Nullable String sSearch)
    Get the last token from (and excluding) the separating string.
    static @NonNull String
    getLeadingZero(int nValue, int nChars)
    Get a string representation of the passed int value with leading zeros.
    static @NonNull String
    getLeadingZero(long nValue, int nChars)
    Get a string representation of the passed long value with leading zeros.
    static @NonNull String
    getLeadingZero(@NonNull String sValue, int nChars)
    Get the passed string padded with leading zeros until the minimum number of characters is reached.
    static @Nullable String
    getLeadingZero(@Nullable Byte aValue, int nChars)
    Get a string representation of the passed Byte value with leading zeros.
    static @Nullable String
    getLeadingZero(@Nullable Integer aValue, int nChars)
    Get a string representation of the passed Integer value with leading zeros.
    static @Nullable String
    getLeadingZero(@Nullable Long aValue, int nChars)
    Get a string representation of the passed Long value with leading zeros.
    static @Nullable String
    getLeadingZero(@Nullable Short aValue, int nChars)
    Get a string representation of the passed Short value with leading zeros.
    static int
    getLength(@Nullable CharSequence aCS)
    Get the length of the passed character sequence.
    static @Nullable CharSequence
    getNotEmpty(@Nullable CharSequence s, @Nullable CharSequence sDefaultIfEmpty)
    Get the passed char sequence but never return an empty char sequence.
    static @Nullable CharSequence
    getNotEmpty(@Nullable CharSequence s, @Nullable Supplier<? extends CharSequence> aDefaultIfEmpty)
    Get the passed char sequence but never return an empty char sequence.
    static @Nullable String
    getNotEmpty(@Nullable String s, @Nullable String sDefaultIfEmpty)
    Get the passed string but never return an empty string.
    static @Nullable String
    getNotEmpty(@Nullable String s, @NonNull Supplier<String> aDefaultIfEmpty)
    Get the passed string but never return an empty string.
    static @NonNull CharSequence
    getNotNull(@Nullable CharSequence s)
    Get the passed CharSequence but never return null.
    static @Nullable CharSequence
    getNotNull(@Nullable CharSequence s, @Nullable CharSequence sDefaultIfNull)
    Get the passed CharSequence but never return null.
    static @Nullable CharSequence
    getNotNull(@Nullable CharSequence s, @NonNull Supplier<? extends CharSequence> aDefaultIfNull)
    Get the passed CharSequence but never return null.
    static @NonNull String
    getNotNull(@Nullable String s)
    Get the passed string but never return null.
    static @Nullable String
    getNotNull(@Nullable String s, @Nullable String sDefaultIfNull)
    Get the passed string but never return null.
    static @Nullable String
    getNotNull(@Nullable String s, @NonNull Supplier<String> aDefaultIfNull)
    Get the passed string but never return null.
    static @NonNull String
    getQuoted(@Nullable String sSource)
    Get the provided string quoted or unquoted if it is null.
    static @NonNull String
    getRepeated(char cElement, int nRepeats)
    Get the passed string element repeated for a certain number of times.
    static @NonNull String
    getRepeated(@NonNull String sElement, int nRepeats)
    Get the passed string element repeated for a certain number of times.
    static @Nullable String
    getReverse(@Nullable String sStr)
    Get the reversed version of the passed string.
    static @NonNull String
    getToString(@Nullable Object aObject)
    Convert the passed object to a string using the Object.toString() method.
    static @Nullable String
    getToString(@Nullable Object aObject, @Nullable String sNullValue)
    Convert the passed object to a string using the Object.toString() method or otherwise return the passed default value.
    static @Nullable String
    getUntilFirstExcl(@Nullable String sStr, char cSearch)
    Get everything from the string up to and excluding first the passed char.
    static @Nullable String
    getUntilFirstExcl(@Nullable String sStr, @Nullable String sSearch)
    Get everything from the string up to and excluding the first passed string.
    static @Nullable String
    getUntilFirstIncl(@Nullable String sStr, char cSearch)
    Get everything from the string up to and including the first passed char.
    static @Nullable String
    getUntilFirstIncl(@Nullable String sStr, @Nullable String sSearch)
    Get everything from the string up to and including the first passed string.
    static @Nullable String
    getUntilLastExcl(@Nullable String sStr, char cSearch)
    Get everything from the string up to and excluding first the passed char.
    static @Nullable String
    getUntilLastExcl(@Nullable String sStr, @Nullable String sSearch)
    Get everything from the string up to and excluding the first passed string.
    static @Nullable String
    getUntilLastIncl(@Nullable String sStr, char cSearch)
    Get everything from the string up to and including the first passed char.
    static @Nullable String
    getUntilLastIncl(@Nullable String sStr, @Nullable String sSearch)
    Get everything from the string up to and including the first passed string.
    static @NonNull String
    getWithLeading(int nValue, int nMinLen, char cFront)
    Get a string that is filled at the beginning with the passed character until the minimum length is reached.
    static @NonNull String
    getWithLeading(long nValue, int nMinLen, char cFront)
    Get a string that is filled at the beginning with the passed character until the minimum length is reached.
    static @NonNull String
    getWithLeading(@Nullable String sSrc, int nMinLen, char cFront)
    Get a string that is filled at the beginning with the passed character until the minimum length is reached.
    static @NonNull String
    getWithoutAnySpaces(@Nullable String sStr)
    Get the passed string where all spaces (white spaces or unicode spaces) have been removed.
    static @NonNull String
    getWithoutLeadingChar(@Nullable String sStr)
    Get the passed string without the first char.
    static @NonNull String
    getWithoutLeadingChars(@Nullable String sStr, int nCount)
    Get the passed string without the specified number of leading chars.
    static @NonNull String
    Get the passed string without the last char.
    static @NonNull String
    getWithoutTrailingChars(@Nullable String sStr, int nCount)
    Get the passed string without the specified number of trailing chars.
    static @NonNull String
    getWithTrailing(@Nullable String sSrc, int nMinLen, char cEnd)
    Get a string that is filled at the end with the passed character until the minimum length is reached.
    static boolean
    hasNoText(@Nullable CharSequence aCS)
    Deprecated, for removal: This API element is subject to removal in a future version.
    static boolean
    hasNoText(@Nullable String sStr)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Use isEmpty(String) instead
    static boolean
    hasText(@Nullable CharSequence aCS)
    Deprecated, for removal: This API element is subject to removal in a future version.
    static boolean
    hasText(@Nullable String sStr)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Use isNotEmpty(String) instead
    static boolean
    hasTextAfterTrim(@Nullable String s)
    Deprecated, for removal: This API element is subject to removal in a future version.
    static boolean
    Check if the passed character sequence is only whitespace or not.
    static boolean
    isEmpty(@Nullable CharSequence aCS)
    Check if the string is null or empty.
    static boolean
    isEmpty(@Nullable String sStr)
    Check if the string is null or empty.
    static boolean
    isEmptyAfterTrim(@Nullable String s)
    Check if the string is null or empty after trimming.
    static boolean
    isNotEmpty(@Nullable CharSequence aCS)
    Check if the string contains any char.
    static boolean
    isNotEmpty(@Nullable String sStr)
    Check if the string contains any char.
    static boolean
    Check if the string neither null nor empty after trimming.
    static void
    iterateChars(@Nullable String sInputString, @NonNull ICharConsumer aConsumer)
    Iterate all characters and pass them to the provided consumer.
    static void
    iterateCodePoints(@Nullable String sInputString, @NonNull IntConsumer aConsumer)
    Iterate all code points and pass them to the provided consumer.
    static boolean
    startsWith(@Nullable CharSequence aCS, char c)
    Check if the passed character sequence starts with the passed character.
    static boolean
    startsWith(@Nullable CharSequence aCS, @Nullable CharSequence aSearch)
    Check if the passed character sequence starts with the passed search sequence.
    static boolean
    startsWith(@Nullable String sStr, @Nullable String sSearch)
    Check if the passed string starts with the passed search string.
    static boolean
    startsWithAny(@Nullable CharSequence aCS, char @Nullable [] aChars)
    Check if the passed character sequence starts with any of the passed characters.
    static boolean
    startsWithIgnoreCase(@Nullable CharSequence aCS, char c)
    Check if the passed character sequence starts with the passed character, ignoring case.
    static boolean
    startsWithIgnoreCase(@Nullable String sStr, @Nullable String sSearch)
    Check if the passed string starts with the passed search string, ignoring case.
    static @Nullable String
    trim(@Nullable String s)
    Trim the passed string, if it is not null.
    static @Nullable String
    trimEnd(@Nullable String sSrc, char cTail)
    Trim the passed tail from the source value.
    static @Nullable String
    trimEnd(@Nullable String sSrc, int nCount)
    Trim the passed tail from the source value.
    static @Nullable String
    trimEnd(@Nullable String sSrc, @Nullable String sTail)
    Trim the passed tail from the source value.
    static @Nullable String
    trimEndRepeatedly(@Nullable String sSrc, char cTail)
    Trim the passed tail character from the source value repeatedly until the source no longer ends with the tail.
    static @Nullable String
    trimEndRepeatedly(@Nullable String sSrc, @Nullable String sTail)
    Trim the passed tail from the source value repeatedly until the source no longer ends with the tail.
    static @Nullable String
    Remove any leading whitespaces from the passed string.
    static @Nullable String
    trimStart(@Nullable String sSrc, char cLead)
    Trim the passed lead from the source value.
    static @Nullable String
    trimStart(@Nullable String sSrc, int nCount)
    Trim the passed lead from the source value.
    static @Nullable String
    trimStart(@Nullable String sSrc, @Nullable String sLead)
    Trim the passed lead from the source value.
    static @Nullable String
    trimStartAndEnd(@Nullable String sSrc, char cValueToTrim)
    Trim the passed lead and tail from the source value.
    static @Nullable String
    trimStartAndEnd(@Nullable String sSrc, char cLead, char cTail)
    Trim the passed lead and tail from the source value.
    static @Nullable String
    trimStartAndEnd(@Nullable String sSrc, @Nullable String sValueToTrim)
    Trim the passed lead and tail from the source value.
    static @Nullable String
    trimStartAndEnd(@Nullable String sSrc, @Nullable String sLead, @Nullable String sTail)
    Trim the passed lead and tail from the source value.
    static @Nullable String
    trimStartRepeatedly(@Nullable String sSrc, char cLead)
    Trim the passed lead character from the source value repeatedly until the source no longer starts with the lead.
    static @Nullable String
    trimStartRepeatedly(@Nullable String sSrc, @Nullable String sLead)
    Trim the passed lead from the source value repeatedly until the source no longer starts with the lead.
    static @Nullable String
    Remove any trailing whitespaces from the passed string.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • StringHelper

      protected StringHelper()
  • Method Details

    • isEmpty

      public static boolean isEmpty(@Nullable CharSequence aCS)
      Check if the string is null or empty.
      Parameters:
      aCS - The character sequence to check. May be null.
      Returns:
      true if the string is null or empty, false otherwise
      Since:
      10.1.8
    • isEmpty

      public static boolean isEmpty(@Nullable String sStr)
      Check if the string is null or empty.
      Parameters:
      sStr - The string to check. May be null.
      Returns:
      true if the string is null or empty, false otherwise
      Since:
      10.1.8
    • isEmptyAfterTrim

      public static boolean isEmptyAfterTrim(@Nullable String s)
      Check if the string is null or empty after trimming.
      Parameters:
      s - The string to check. May be null.
      Returns:
      true if the string is null or empty or consists only of whitespaces, false otherwise
      Since:
      10.1.8
    • isNotEmpty

      public static boolean isNotEmpty(@Nullable CharSequence aCS)
      Check if the string contains any char.
      Parameters:
      aCS - The character sequence to check. May be null.
      Returns:
      true if the string contains at least one, false otherwise
      Since:
      10.1.8
    • isNotEmpty

      public static boolean isNotEmpty(@Nullable String sStr)
      Check if the string contains any char.
      Parameters:
      sStr - The string to check. May be null.
      Returns:
      true if the string contains at least one char, false otherwise
      Since:
      10.1.8
    • isNotEmptyAfterTrim

      public static boolean isNotEmptyAfterTrim(@Nullable String s)
      Check if the string neither null nor empty after trimming.
      Parameters:
      s - The string to check. May be null.
      Returns:
      true if the string is neither null nor empty nor consists only of whitespaces, false otherwise
      Since:
      10.1.8
    • hasNoText

      @Deprecated(forRemoval=true, since="12.0.0") public static boolean hasNoText(@Nullable CharSequence aCS)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Check if the string is null or empty.
      Parameters:
      aCS - The character sequence to check. May be null.
      Returns:
      true if the string is null or empty, false otherwise
    • hasNoText

      @Deprecated(forRemoval=true, since="12.0.0") public static boolean hasNoText(@Nullable String sStr)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use isEmpty(String) instead
      Check if the string is null or empty.
      Parameters:
      sStr - The string to check. May be null.
      Returns:
      true if the string is null or empty, false otherwise
    • hasText

      @Deprecated(forRemoval=true, since="12.0.0") public static boolean hasText(@Nullable CharSequence aCS)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Check if the string contains any char.
      Parameters:
      aCS - The character sequence to check. May be null.
      Returns:
      true if the string contains at least one, false otherwise
    • hasText

      @Deprecated(forRemoval=true, since="12.0.0") public static boolean hasText(@Nullable String sStr)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use isNotEmpty(String) instead
      Check if the string contains any char.
      Parameters:
      sStr - The string to check. May be null.
      Returns:
      true if the string contains at least one char, false otherwise
    • hasTextAfterTrim

      @Deprecated(forRemoval=true, since="12.0.0") public static boolean hasTextAfterTrim(@Nullable String s)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Check if the string neither null nor empty after trimming.
      Parameters:
      s - The string to check. May be null.
      Returns:
      true if the string is neither null nor empty nor consists only of whitespaces, false otherwise
    • getLength

      @Nonnegative public static int getLength(@Nullable CharSequence aCS)
      Get the length of the passed character sequence.
      Parameters:
      aCS - The character sequence who's length is to be determined. May be null.
      Returns:
      0 if the parameter is null, its length otherwise.
      See Also:
    • getNotNull

      public static @NonNull String getNotNull(@Nullable String s)
      Get the passed string but never return null. If the passed parameter is null an empty string is returned.
      Parameters:
      s - The parameter to be not null.
      Returns:
      An empty string if the passed parameter is null, the passed string otherwise.
    • getNotNull

      public static @Nullable String getNotNull(@Nullable String s, @Nullable String sDefaultIfNull)
      Get the passed string but never return null. If the passed parameter is null the second parameter is returned.
      Parameters:
      s - The parameter to be not null.
      sDefaultIfNull - The value to be used if the first parameter is null. May be null but in this case the call to this method is obsolete.
      Returns:
      The passed default value if the string is null, otherwise the input string.
    • getNotNull

      public static @Nullable String getNotNull(@Nullable String s, @NonNull Supplier<String> aDefaultIfNull)
      Get the passed string but never return null. If the passed parameter is null the second parameter is returned.
      Parameters:
      s - The parameter to be not null.
      aDefaultIfNull - The value supplier to be used if the first parameter is null. May not be null.
      Returns:
      The passed default value if the string is null, otherwise the input string.
      Since:
      10.2.0
    • getNotNull

      public static @NonNull CharSequence getNotNull(@Nullable CharSequence s)
      Get the passed CharSequence but never return null. If the passed parameter is null an empty string is returned.
      Parameters:
      s - The parameter to be not null.
      Returns:
      An empty string if the passed parameter is null, the passed CharSequence otherwise.
    • getNotNull

      public static @Nullable CharSequence getNotNull(@Nullable CharSequence s, @Nullable CharSequence sDefaultIfNull)
      Get the passed CharSequence but never return null. If the passed parameter is null the second parameter is returned.
      Parameters:
      s - The parameter to be not null.
      sDefaultIfNull - The value to be used if the first parameter is null. May be null but in this case the call to this method is obsolete.
      Returns:
      The passed default value if the string is null, otherwise the input CharSequence.
    • getNotNull

      public static @Nullable CharSequence getNotNull(@Nullable CharSequence s, @NonNull Supplier<? extends CharSequence> aDefaultIfNull)
      Get the passed CharSequence but never return null. If the passed parameter is null the second parameter is returned.
      Parameters:
      s - The parameter to be not null.
      aDefaultIfNull - The value supplier to be used if the first parameter is null. May not be null.
      Returns:
      The passed default value if the string is null, otherwise the input CharSequence.
      Since:
      10.2.0
    • getNotEmpty

      public static @Nullable String getNotEmpty(@Nullable String s, @Nullable String sDefaultIfEmpty)
      Get the passed string but never return an empty string. If the passed parameter is null or empty the second parameter is returned.
      Parameters:
      s - The parameter to be not null nor empty.
      sDefaultIfEmpty - The value to be used if the first parameter is null or empty. May be null but in this case the call to this method is obsolete.
      Returns:
      The passed default value if the string is null or empty, otherwise the input string.
    • getNotEmpty

      public static @Nullable String getNotEmpty(@Nullable String s, @NonNull Supplier<String> aDefaultIfEmpty)
      Get the passed string but never return an empty string. If the passed parameter is null or empty the second parameter is returned.
      Parameters:
      s - The parameter to be not null nor empty.
      aDefaultIfEmpty - The value supplier to be used if the first parameter is null or empty. May not be null.
      Returns:
      The passed default value if the string is null or empty, otherwise the input string.
      Since:
      10.2.0
    • getNotEmpty

      public static @Nullable CharSequence getNotEmpty(@Nullable CharSequence s, @Nullable CharSequence sDefaultIfEmpty)
      Get the passed char sequence but never return an empty char sequence. If the passed parameter is null or empty the second parameter is returned.
      Parameters:
      s - The parameter to be not null nor empty.
      sDefaultIfEmpty - The value to be used if the first parameter is null or empty. May be null but in this case the call to this method is obsolete.
      Returns:
      The passed default value if the char sequence is null or empty, otherwise the input char sequence.
    • getNotEmpty

      public static @Nullable CharSequence getNotEmpty(@Nullable CharSequence s, @Nullable Supplier<? extends CharSequence> aDefaultIfEmpty)
      Get the passed char sequence but never return an empty char sequence. If the passed parameter is null or empty the second parameter is returned.
      Parameters:
      s - The parameter to be not null nor empty.
      aDefaultIfEmpty - The value supplier to be used if the first parameter is null or empty. May not be null.
      Returns:
      The passed default value if the char sequence is null or empty, otherwise the input char sequence.
      Since:
      10.2.0
    • getRepeated

      public static @NonNull String getRepeated(char cElement, @Nonnegative int nRepeats)
      Get the passed string element repeated for a certain number of times. Each string element is simply appended at the end of the string.
      Parameters:
      cElement - The character to get repeated.
      nRepeats - The number of repetitions to retrieve. May not be < 0.
      Returns:
      A non-null string containing the string element for the given number of times.
    • getRepeated

      public static @NonNull String getRepeated(@NonNull String sElement, @Nonnegative int nRepeats)
      Get the passed string element repeated for a certain number of times. Each string element is simply appended at the end of the string.
      Parameters:
      sElement - The string to get repeated. May not be null.
      nRepeats - The number of repetitions to retrieve. May not be < 0.
      Returns:
      A non-null string containing the string element for the given number of times.
    • getWithLeading

      public static @NonNull String getWithLeading(@Nullable String sSrc, @Nonnegative int nMinLen, char cFront)
      Get a string that is filled at the beginning with the passed character until the minimum length is reached. If the input string is empty, the result is a string with the provided len only consisting of the passed characters. If the input String is longer than the provided length, it is returned unchanged.
      Parameters:
      sSrc - Source string. May be null.
      nMinLen - Minimum length. Should be > 0.
      cFront - The character to be used at the beginning
      Returns:
      A non-null string that has at least nLen chars
    • getWithLeading

      public static @NonNull String getWithLeading(int nValue, @Nonnegative int nMinLen, char cFront)
      Get a string that is filled at the beginning with the passed character until the minimum length is reached. If the input String is longer than the provided length, it is returned unchanged.
      Parameters:
      nValue - Source string. May be null.
      nMinLen - Minimum length. Should be > 0.
      cFront - The character to be used at the beginning
      Returns:
      A non-null string that has at least nLen chars
      See Also:
    • getWithLeading

      public static @NonNull String getWithLeading(long nValue, @Nonnegative int nMinLen, char cFront)
      Get a string that is filled at the beginning with the passed character until the minimum length is reached. If the input String is longer than the provided length, it is returned unchanged.
      Parameters:
      nValue - Source string. May be null.
      nMinLen - Minimum length. Should be > 0.
      cFront - The character to be used at the beginning
      Returns:
      A non-null string that has at least nLen chars
      See Also:
    • getWithTrailing

      public static @NonNull String getWithTrailing(@Nullable String sSrc, @Nonnegative int nMinLen, char cEnd)
      Get a string that is filled at the end with the passed character until the minimum length is reached. If the input string is empty, the result is a string with the provided len only consisting of the passed characters. If the input String is longer than the provided length, it is returned unchanged.
      Parameters:
      sSrc - Source string. May be null.
      nMinLen - Minimum length. Should be > 0.
      cEnd - The character to be used at the end
      Returns:
      A non-null string that has at least nLen chars
    • getLeadingZero

      public static @Nullable String getLeadingZero(@Nullable Byte aValue, int nChars)
      Get a string representation of the passed Byte value with leading zeros.
      Parameters:
      aValue - The value to be formatted. May be null.
      nChars - The minimum number of characters to return.
      Returns:
      null if the passed value is null, the formatted string otherwise.
    • getLeadingZero

      public static @Nullable String getLeadingZero(@Nullable Integer aValue, int nChars)
      Get a string representation of the passed Integer value with leading zeros.
      Parameters:
      aValue - The value to be formatted. May be null.
      nChars - The minimum number of characters to return.
      Returns:
      null if the passed value is null, the formatted string otherwise.
    • getLeadingZero

      public static @Nullable String getLeadingZero(@Nullable Long aValue, int nChars)
      Get a string representation of the passed Long value with leading zeros.
      Parameters:
      aValue - The value to be formatted. May be null.
      nChars - The minimum number of characters to return.
      Returns:
      null if the passed value is null, the formatted string otherwise.
    • getLeadingZero

      public static @Nullable String getLeadingZero(@Nullable Short aValue, int nChars)
      Get a string representation of the passed Short value with leading zeros.
      Parameters:
      aValue - The value to be formatted. May be null.
      nChars - The minimum number of characters to return.
      Returns:
      null if the passed value is null, the formatted string otherwise.
    • getLeadingZero

      public static @NonNull String getLeadingZero(int nValue, int nChars)
      Get a string representation of the passed int value with leading zeros. Negative values are prefixed with a minus sign.
      Parameters:
      nValue - The value to be formatted.
      nChars - The minimum number of characters to return (excluding the minus sign for negative values).
      Returns:
      A non-null string with at least nChars characters.
    • getLeadingZero

      public static @NonNull String getLeadingZero(long nValue, int nChars)
      Get a string representation of the passed long value with leading zeros. Negative values are prefixed with a minus sign.
      Parameters:
      nValue - The value to be formatted.
      nChars - The minimum number of characters to return (excluding the minus sign for negative values).
      Returns:
      A non-null string with at least nChars characters.
    • getLeadingZero

      public static @NonNull String getLeadingZero(@NonNull String sValue, int nChars)
      Get the passed string padded with leading zeros until the minimum number of characters is reached.
      Parameters:
      sValue - The value to be padded. May not be null.
      nChars - The minimum number of characters to return.
      Returns:
      A non-null string with at least nChars characters.
      See Also:
    • getReverse

      public static @Nullable String getReverse(@Nullable String sStr)
      Get the reversed version of the passed string.
      Parameters:
      sStr - The source string. May be null.
      Returns:
      null if the input string is null, the reversed string otherwise.
    • getFirstChar

      public static char getFirstChar(@Nullable CharSequence aCS)
      Get the first character of the passed character sequence
      Parameters:
      aCS - The source character sequence
      Returns:
      CGlobal.ILLEGAL_CHAR if the passed sequence was empty
    • getFirstChar

      public static char getFirstChar(char @Nullable [] aChars)
      Get the first character of the passed array
      Parameters:
      aChars - The character array
      Returns:
      CGlobal.ILLEGAL_CHAR if the passed array was empty
    • getLastChar

      public static char getLastChar(@Nullable CharSequence aCS)
      Get the last character of the passed character sequence
      Parameters:
      aCS - The source character sequence
      Returns:
      CGlobal.ILLEGAL_CHAR if the passed sequence was empty
    • getLastChar

      public static char getLastChar(char @Nullable [] aChars)
      Get the last character of the passed array
      Parameters:
      aChars - The character array
      Returns:
      CGlobal.ILLEGAL_CHAR if the passed array was empty
    • getIndexOf

      public static int getIndexOf(@Nullable String sText, @Nullable String sSearch)
      Get the first index of sSearch within sText.
      Parameters:
      sText - The text to search in. May be null.
      sSearch - The text to search for. May be null.
      Returns:
      The first index of sSearch within sText or -1 if sSearch was not found or if any parameter was null.
      See Also:
    • getIndexOf

      public static int getIndexOf(@Nullable String sText, @Nonnegative int nFromIndex, @Nullable String sSearch)
      Get the first index of sSearch within sText starting at index nFromIndex.
      Parameters:
      sText - The text to search in. May be null.
      nFromIndex - The index to start searching in the source string
      sSearch - The text to search for. May be null.
      Returns:
      The first index of sSearch within sText or -1 if sSearch was not found or if any parameter was null.
      See Also:
    • getLastIndexOf

      public static int getLastIndexOf(@Nullable String sText, @Nullable String sSearch)
      Get the last index of sSearch within sText.
      Parameters:
      sText - The text to search in. May be null.
      sSearch - The text to search for. May be null.
      Returns:
      The last index of sSearch within sText or -1 if sSearch was not found or if any parameter was null.
      See Also:
    • getLastIndexOf

      public static int getLastIndexOf(@Nullable String sText, @Nonnegative int nFromIndex, @Nullable String sSearch)
      Get the last index of sSearch within sText starting at index nFromIndex.
      Parameters:
      sText - The text to search in. May be null.
      nFromIndex - The index to start searching in the source string
      sSearch - The text to search for. May be null.
      Returns:
      The last index of sSearch within sText or -1 if sSearch was not found or if any parameter was null.
      See Also:
    • getIndexOf

      public static int getIndexOf(@Nullable String sText, char cSearch)
      Get the first index of cSearch within sText.
      Parameters:
      sText - The text to search in. May be null.
      cSearch - The character to search for. May be null.
      Returns:
      The first index of sSearch within sText or -1 if cSearch was not found or if any parameter was null.
      See Also:
    • getIndexOf

      public static int getIndexOf(@Nullable String sText, @Nonnegative int nFromIndex, char cSearch)
      Get the first index of cSearch within sText starting at index nFromIndex.
      Parameters:
      sText - The text to search in. May be null.
      nFromIndex - The index to start searching in the source string
      cSearch - The character to search for. May be null.
      Returns:
      The first index of sSearch within sText or -1 if cSearch was not found or if any parameter was null.
      See Also:
    • getLastIndexOf

      public static int getLastIndexOf(@Nullable String sText, char cSearch)
      Get the last index of cSearch within sText.
      Parameters:
      sText - The text to search in. May be null.
      cSearch - The character to search for. May be null.
      Returns:
      The last index of sSearch within sText or -1 if cSearch was not found or if any parameter was null.
      See Also:
    • getLastIndexOf

      public static int getLastIndexOf(@Nullable String sText, @Nonnegative int nFromIndex, char cSearch)
      Get the last index of cSearch within sText starting at index nFromIndex.
      Parameters:
      sText - The text to search in. May be null.
      nFromIndex - The index to start searching in the source string
      cSearch - The character to search for. May be null.
      Returns:
      The last index of sSearch within sText or -1 if cSearch was not found or if any parameter was null.
      See Also:
    • getIndexOfIgnoreCase

      public static int getIndexOfIgnoreCase(@Nullable String sText, @Nullable String sSearch, @NonNull Locale aSortLocale)
      Get the first index of sSearch within sText ignoring case.
      Parameters:
      sText - The text to search in. May be null.
      sSearch - The text to search for. May be null.
      aSortLocale - The locale to be used for case unifying.
      Returns:
      The first index of sSearch within sText or -1 if sSearch was not found or if any parameter was null.
      See Also:
    • getIndexOfIgnoreCase

      public static int getIndexOfIgnoreCase(@Nullable String sText, @Nonnegative int nFromIndex, @Nullable String sSearch, @NonNull Locale aSortLocale)
      Get the first index of sSearch within sText ignoring case starting at index nFromIndex.
      Parameters:
      sText - The text to search in. May be null.
      nFromIndex - The index to start searching in the source string
      sSearch - The text to search for. May be null.
      aSortLocale - The locale to be used for case unifying.
      Returns:
      The first index of sSearch within sText or -1 if sSearch was not found or if any parameter was null.
      See Also:
    • getLastIndexOfIgnoreCase

      public static int getLastIndexOfIgnoreCase(@Nullable String sText, @Nullable String sSearch, @NonNull Locale aSortLocale)
      Get the last index of sSearch within sText ignoring case.
      Parameters:
      sText - The text to search in. May be null.
      sSearch - The text to search for. May be null.
      aSortLocale - The locale to be used for case unifying.
      Returns:
      The last index of sSearch within sText or -1 if sSearch was not found or if any parameter was null.
      See Also:
    • getLastIndexOfIgnoreCase

      public static int getLastIndexOfIgnoreCase(@Nullable String sText, @Nonnegative int nFromIndex, @Nullable String sSearch, @NonNull Locale aSortLocale)
      Get the last index of sSearch within sText ignoring case starting at index nFromIndex.
      Parameters:
      sText - The text to search in. May be null.
      nFromIndex - The index to start searching in the source string
      sSearch - The text to search for. May be null.
      aSortLocale - The locale to be used for case unifying.
      Returns:
      The last index of sSearch within sText or -1 if sSearch was not found or if any parameter was null.
      See Also:
    • getIndexOfIgnoreCase

      public static int getIndexOfIgnoreCase(@Nullable String sText, char cSearch, @NonNull Locale aSortLocale)
      Get the first index of cSearch within sText ignoring case.
      Parameters:
      sText - The text to search in. May be null.
      cSearch - The char to search for. May be null.
      aSortLocale - The locale to be used for case unifying.
      Returns:
      The first index of sSearch within sText or -1 if sSearch was not found or if any parameter was null.
      See Also:
    • getIndexOfIgnoreCase

      public static int getIndexOfIgnoreCase(@Nullable String sText, @Nonnegative int nFromIndex, char cSearch, @NonNull Locale aSortLocale)
      Get the first index of cSearch within sText ignoring case starting at index nFromIndex.
      Parameters:
      sText - The text to search in. May be null.
      nFromIndex - The index to start searching in the source string
      cSearch - The char to search for. May be null.
      aSortLocale - The locale to be used for case unifying.
      Returns:
      The first index of sSearch within sText or -1 if sSearch was not found or if any parameter was null.
      See Also:
    • getLastIndexOfIgnoreCase

      public static int getLastIndexOfIgnoreCase(@Nullable String sText, char cSearch, @NonNull Locale aSortLocale)
      Get the last index of cSearch within sText ignoring case.
      Parameters:
      sText - The text to search in. May be null.
      cSearch - The char to search for. May be null.
      aSortLocale - The locale to be used for case unifying.
      Returns:
      The last index of sSearch within sText or -1 if sSearch was not found or if any parameter was null.
      See Also:
    • getLastIndexOfIgnoreCase

      public static int getLastIndexOfIgnoreCase(@Nullable String sText, @Nonnegative int nFromIndex, char cSearch, @NonNull Locale aSortLocale)
      Get the last index of cSearch within sText ignoring case starting at index nFromIndex.
      Parameters:
      sText - The text to search in. May be null.
      nFromIndex - The index to start searching in the source string
      cSearch - The char to search for. May be null.
      aSortLocale - The locale to be used for case unifying.
      Returns:
      The last index of sSearch within sText or -1 if sSearch was not found or if any parameter was null.
      See Also:
    • contains

      public static boolean contains(@Nullable String sText, @Nullable String sSearch)
      Check if sSearch is contained within sText.
      Parameters:
      sText - The text to search in. May be null.
      sSearch - The text to search for. May be null.
      Returns:
      true if sSearch is contained in sText, false otherwise.
      See Also:
    • contains

      public static boolean contains(@Nullable String sText, char cSearch)
      Check if cSearch is contained within sText.
      Parameters:
      sText - The text to search in. May be null.
      cSearch - The character to search for. May be null.
      Returns:
      true if cSearch is contained in sText, false otherwise.
      See Also:
    • containsIgnoreCase

      public static boolean containsIgnoreCase(@Nullable String sText, @Nullable String sSearch, @NonNull Locale aSortLocale)
      Check if sSearch is contained within sText ignoring case.
      Parameters:
      sText - The text to search in. May be null.
      sSearch - The text to search for. May be null.
      aSortLocale - The locale to be used for case unifying.
      Returns:
      true if sSearch is contained in sText, false otherwise.
      See Also:
    • containsIgnoreCase

      public static boolean containsIgnoreCase(@Nullable String sText, char cSearch, @NonNull Locale aSortLocale)
      Check if cSearch is contained within sText ignoring case.
      Parameters:
      sText - The text to search in. May be null.
      cSearch - The char to search for. May be null.
      aSortLocale - The locale to be used for case unifying.
      Returns:
      true if sSearch is contained in sText, false otherwise.
      See Also:
    • containsAny

      public static boolean containsAny(char @Nullable [] aInput, char @NonNull [] aSearchChars)
      Check if any of the passed searched characters is contained in the input char array.
      Parameters:
      aInput - The input char array. May be null.
      aSearchChars - The char array to search. May not be null.
      Returns:
      true if at least any of the search char is contained in the input char array, false otherwise.
    • containsAny

      public static boolean containsAny(@Nullable String sInput, char @NonNull [] aSearchChars)
      Check if any of the passed searched characters in contained in the input string.
      Parameters:
      sInput - The input string. May be null.
      aSearchChars - The char array to search. May not be null.
      Returns:
      true if at least any of the search char is contained in the input char array, false otherwise.
    • iterateChars

      public static void iterateChars(@Nullable String sInputString, @NonNull ICharConsumer aConsumer)
      Iterate all characters and pass them to the provided consumer.
      Parameters:
      sInputString - Input String to use. May be null or empty.
      aConsumer - The consumer to be used. May not be null.
    • containsAny

      public static boolean containsAny(@Nullable CharSequence aCS, @Nullable ICharPredicate aFilter)
      Check if the passed CharSequence contains any character matching the provided filter.
      Parameters:
      aCS - String to check. May be null.
      aFilter - The filter to use. May be null.
      Returns:
      true if the filter is null and the string is not empty. true if the filter is not null and at least one character of the string matches the filter. false otherwise.
      Since:
      9.1.7
    • containsAny

      public static boolean containsAny(@Nullable String sStr, @Nullable ICharPredicate aFilter)
      Check if the passed String contains any character matching the provided filter.
      Parameters:
      sStr - String to check. May be null.
      aFilter - The filter to use. May be null.
      Returns:
      true if the filter is null and the string is not empty. true if the filter is not null and at least one character of the string matches the filter. false otherwise.
      Since:
      9.1.7
    • containsNone

      public static boolean containsNone(@Nullable CharSequence aCS, @Nullable ICharPredicate aFilter)
      Check if the passed CharSequence contains no character matching the provided filter.
      Parameters:
      aCS - String to check. May be null.
      aFilter - The filter to use. May be null.
      Returns:
      true if the filter is null and the string is empty. true if the filter is not null and no character of the string matches the filter. false otherwise.
      Since:
      9.1.7
    • containsNone

      public static boolean containsNone(@Nullable String sStr, @Nullable ICharPredicate aFilter)
      Check if the passed String contains no character matching the provided filter.
      Parameters:
      sStr - String to check. May be null.
      aFilter - The filter to use. May be null.
      Returns:
      true if the filter is null and the string is empty. true if the filter is not null and no character of the string matches the filter. false otherwise.
      Since:
      9.1.7
    • containsOnly

      public static boolean containsOnly(@Nullable CharSequence aCS, @Nullable ICharPredicate aFilter)
      Check if the passed CharSequence contains only characters matching the provided filter.
      Parameters:
      aCS - String to check. May be null.
      aFilter - The filter to use. May be null.
      Returns:
      true if the filter is null and the string is not empty. true if the filter is not null and the string has at least one character and all characters of the string match the filter. false otherwise.
      Since:
      9.1.7
    • containsOnly

      public static boolean containsOnly(@Nullable String sStr, @Nullable ICharPredicate aFilter)
      Check if the passed String contains only characters matching the provided filter.
      Parameters:
      sStr - String to check. May be null.
      aFilter - The filter to use. May be null.
      Returns:
      true if the filter is null and the string is not empty. true if the filter is not null and the string has at least one character and all characters of the string match the filter. false otherwise.
      Since:
      9.1.7
    • isAllWhitespace

      public static boolean isAllWhitespace(@Nullable CharSequence s)
      Check if the passed character sequence is only whitespace or not.
      Parameters:
      s - The character sequence to be checked. May be null.
      Returns:
      true if the passed sequence is empty or if only whitespace characters are contained.
      See Also:
    • startsWith

      public static boolean startsWith(@Nullable CharSequence aCS, char c)
      Check if the passed character sequence starts with the passed character.
      Parameters:
      aCS - The character sequence to check. May be null.
      c - The character to search for.
      Returns:
      true if the character sequence starts with the passed character, false otherwise.
    • startsWithAny

      public static boolean startsWithAny(@Nullable CharSequence aCS, char @Nullable [] aChars)
      Check if the passed character sequence starts with any of the passed characters.
      Parameters:
      aCS - The character sequence to check. May be null.
      aChars - The characters to search for. May be null.
      Returns:
      true if the character sequence starts with any of the passed characters, false otherwise.
    • startsWithIgnoreCase

      public static boolean startsWithIgnoreCase(@Nullable CharSequence aCS, char c)
      Check if the passed character sequence starts with the passed character, ignoring case.
      Parameters:
      aCS - The character sequence to check. May be null.
      c - The character to search for.
      Returns:
      true if the character sequence starts with the passed character (ignoring case), false otherwise.
    • startsWith

      public static boolean startsWith(@Nullable CharSequence aCS, @Nullable CharSequence aSearch)
      Check if the passed character sequence starts with the passed search sequence.
      Parameters:
      aCS - The character sequence to check. May be null.
      aSearch - The character sequence to search for. May be null.
      Returns:
      true if the character sequence starts with the search sequence, false otherwise.
    • startsWith

      public static boolean startsWith(@Nullable String sStr, @Nullable String sSearch)
      Check if the passed string starts with the passed search string.
      Parameters:
      sStr - The string to check. May be null.
      sSearch - The string to search for. May be null.
      Returns:
      true if the string starts with the search string, false otherwise.
    • startsWithIgnoreCase

      public static boolean startsWithIgnoreCase(@Nullable String sStr, @Nullable String sSearch)
      Check if the passed string starts with the passed search string, ignoring case.
      Parameters:
      sStr - The string to check. May be null.
      sSearch - The string to search for. May be null.
      Returns:
      true if the string starts with the search string (ignoring case), false otherwise.
    • endsWith

      public static boolean endsWith(@Nullable CharSequence aCS, char c)
      Check if the passed character sequence ends with the passed character.
      Parameters:
      aCS - The character sequence to check. May be null.
      c - The character to search for.
      Returns:
      true if the character sequence ends with the passed character, false otherwise.
    • endsWithAny

      public static boolean endsWithAny(@Nullable CharSequence aCS, char @Nullable [] aChars)
      Check if the passed character sequence ends with any of the passed characters.
      Parameters:
      aCS - The character sequence to check. May be null.
      aChars - The characters to search for. May be null.
      Returns:
      true if the character sequence ends with any of the passed characters, false otherwise.
    • endsWith

      public static boolean endsWith(@Nullable CharSequence aCS, @Nullable CharSequence aSearch)
      Check if the passed character sequence ends with the passed search sequence.
      Parameters:
      aCS - The character sequence to check. May be null.
      aSearch - The character sequence to search for. May be null.
      Returns:
      true if the character sequence ends with the search sequence, false otherwise.
    • endsWith

      public static boolean endsWith(@Nullable String sStr, @Nullable String sSearch)
      Check if the passed string ends with the passed search string.
      Parameters:
      sStr - The string to check. May be null.
      sSearch - The string to search for. May be null.
      Returns:
      true if the string ends with the search string, false otherwise.
    • endsWithIgnoreCase

      public static boolean endsWithIgnoreCase(@Nullable CharSequence aCS, char c)
      Check if the passed character sequence ends with the passed character, ignoring case.
      Parameters:
      aCS - The character sequence to check. May be null.
      c - The character to search for.
      Returns:
      true if the character sequence ends with the passed character (ignoring case), false otherwise.
    • endsWithIgnoreCase

      public static boolean endsWithIgnoreCase(@Nullable String sStr, @Nullable String sSearch)
      Check if the passed string ends with the passed search string, ignoring case.
      Parameters:
      sStr - The string to check. May be null.
      sSearch - The string to search for. May be null.
      Returns:
      true if the string ends with the search string (ignoring case), false otherwise.
    • iterateCodePoints

      public static void iterateCodePoints(@Nullable String sInputString, @NonNull IntConsumer aConsumer)
      Iterate all code points and pass them to the provided consumer. This implementation is approximately 20% quicker than CharSequence.codePoints().forEachOrdered(c)
      Parameters:
      sInputString - Input String to use. May be null or empty.
      aConsumer - The consumer to be used. May not be null.
    • explode

      public static void explode(char cSep, @Nullable String sElements, @NonNull Consumer<? super String> aConsumer)
      Split the provided string by the provided separator and invoke the consumer for each matched element. The number of returned items is unlimited.
      Parameters:
      cSep - The separator to use.
      sElements - The concatenated String to convert. May be null or empty.
      aConsumer - The non-null consumer that is invoked for each exploded element
    • explode

      public static void explode(char cSep, @Nullable String sElements, int nMaxItems, @NonNull Consumer<? super String> aConsumer)
      Split the provided string by the provided separator and invoke the consumer for each matched element. The maximum number of elements can be specified.
      Parameters:
      cSep - The separator to use.
      sElements - The concatenated String to convert. May be null or empty.
      nMaxItems - The maximum number of items to explode. If the passed value is ≤ 0 all items are used. If max items is 1, than the result string is returned as is. If max items is larger than the number of elements found, it has no effect.
      aConsumer - The non-null consumer that is invoked for each exploded element
    • explode

      public static void explode(@NonNull String sSep, @Nullable String sElements, @NonNull Consumer<? super String> aConsumer)
      Split the provided string by the provided separator and invoke the consumer for each matched element.
      Parameters:
      sSep - The separator to use. May not be null.
      sElements - The concatenated String to convert. May be null or empty.
      aConsumer - The non-null consumer that is invoked for each exploded element
    • explode

      public static void explode(@NonNull String sSep, @Nullable String sElements, int nMaxItems, @NonNull Consumer<? super String> aConsumer)
      Split the provided string by the provided separator and invoke the consumer for each matched element. The maximum number of elements can be specified.
      Parameters:
      sSep - The separator to use. May not be null.
      sElements - The concatenated String to convert. May be null or empty.
      nMaxItems - The maximum number of items to explode. If the passed value is ≤ 0 all items are used. If max items is 1, than the result string is returned as is. If max items is larger than the number of elements found, it has no effect.
      aConsumer - The non-null consumer that is invoked for each exploded element
    • getExplodedArray

      public static @NonNull String[] getExplodedArray(char cSep, @Nullable String sElements, @CheckForSigned int nMaxItems)
      Take a concatenated String and return the passed String array of all elements in the passed string, using specified separator char.
      Parameters:
      cSep - The separator to use.
      sElements - The concatenated String to convert. May be null or empty.
      nMaxItems - The maximum number of items to explode. If the passed value is ≤ 0 all items are used. If max items is 1, than the result string is returned as is. If max items is larger than the number of elements found, it has no effect.
      Returns:
      The passed collection and never null.
    • getExplodedArray

      public static @NonNull String[] getExplodedArray(char cSep, @Nullable String sElements)
      Take a concatenated String and return the passed String array of all elements in the passed string, using specified separator char.
      Parameters:
      cSep - The separator to use.
      sElements - The concatenated String to convert. May be null or empty.
      Returns:
      The passed collection and never null.
    • getExploded

      @ReturnsMutableObject("The passed parameter") @CodingStyleguideUnaware public static <COLLTYPE extends Collection<String>> @NonNull COLLTYPE getExploded(char cSep, @Nullable String sElements, int nMaxItems, @NonNull COLLTYPE aCollection)
      Take a concatenated String and return the passed Collection of all elements in the passed string, using specified separator string.
      Type Parameters:
      COLLTYPE - The collection type to be passed and returned
      Parameters:
      cSep - The separator to use.
      sElements - The concatenated String to convert. May be null or empty.
      nMaxItems - The maximum number of items to explode. If the passed value is ≤ 0 all items are used. If max items is 1, than the result string is returned as is. If max items is larger than the number of elements found, it has no effect.
      aCollection - The non-null target collection that should be filled with the exploded elements
      Returns:
      The passed collection and never null.
    • getExploded

      @ReturnsMutableCopy public static @NonNull List<String> getExploded(char cSep, @Nullable String sElements)
      Take a concatenated String and return a List of all elements in the passed string, using specified separator string.
      Parameters:
      cSep - The separator character to use.
      sElements - The concatenated String to convert. May be null or empty.
      Returns:
      The List represented by the passed string. Never null. If the passed input string is null or "" an empty list is returned.
    • getExploded

      @ReturnsMutableCopy public static @NonNull List<String> getExploded(char cSep, @Nullable String sElements, int nMaxItems)
      Take a concatenated String and return a List of all elements in the passed string, using specified separator string.
      Parameters:
      cSep - The separator character to use.
      sElements - The concatenated String to convert. May be null or empty.
      nMaxItems - The maximum number of items to explode. If the passed value is ≤ 0 all items are used. If max items is 1, than the result string is returned as is. If max items is larger than the number of elements found, it has no effect.
      Returns:
      The List represented by the passed string. Never null. If the passed input string is null or "" an empty list is returned.
    • getExploded

      @CodingStyleguideUnaware public static <COLLTYPE extends Collection<String>> @NonNull COLLTYPE getExploded(@NonNull String sSep, @Nullable String sElements, int nMaxItems, @NonNull COLLTYPE aCollection)
      Take a concatenated String and return the passed Collection of all elements in the passed string, using specified separator string.
      Type Parameters:
      COLLTYPE - The collection type to be used and returned
      Parameters:
      sSep - The separator to use. May not be null.
      sElements - The concatenated String to convert. May be null or empty.
      nMaxItems - The maximum number of items to explode. If the passed value is ≤ 0 all items are used. If max items is 1, than the result string is returned as is. If max items is larger than the number of elements found, it has no effect.
      aCollection - The non-null target collection that should be filled with the exploded elements
      Returns:
      The passed collection and never null.
    • getExploded

      @ReturnsMutableCopy public static @NonNull List<String> getExploded(@NonNull String sSep, @Nullable String sElements)
      Take a concatenated String and return a List of all elements in the passed string, using specified separator string.
      Parameters:
      sSep - The separator to use. May not be null.
      sElements - The concatenated String to convert. May be null or empty.
      Returns:
      The List represented by the passed string. Never null. If the passed input string is null or "" an empty list is returned.
    • getExploded

      @ReturnsMutableCopy public static @NonNull List<String> getExploded(@NonNull String sSep, @Nullable String sElements, int nMaxItems)
      Take a concatenated String and return a List of all elements in the passed string, using specified separator string.
      Parameters:
      sSep - The separator to use. May not be null.
      sElements - The concatenated String to convert. May be null or empty.
      nMaxItems - The maximum number of items to explode. If the passed value is ≤ 0 all items are used. If max items is 1, than the result string is returned as is. If max items is larger than the number of elements found, it has no effect.
      Returns:
      The List represented by the passed string. Never null. If the passed input string is null or "" an empty list is returned.
    • getExplodedToSet

      @ReturnsMutableCopy public static @NonNull HashSet<String> getExplodedToSet(@NonNull String sSep, @Nullable String sElements)
      Take a concatenated String and return a Set of all elements in the passed string, using specified separator string.
      Parameters:
      sSep - The separator to use. May not be null.
      sElements - The concatenated String to convert. May be null or empty.
      Returns:
      The Set represented by the passed string. Never null. If the passed input string is null or "" an empty list is returned.
    • getExplodedToOrderedSet

      @ReturnsMutableCopy public static @NonNull LinkedHashSet<String> getExplodedToOrderedSet(@NonNull String sSep, @Nullable String sElements)
      Take a concatenated String and return an ordered LinkedHashSet of all elements in the passed string, using specified separator string.
      Parameters:
      sSep - The separator to use. May not be null.
      sElements - The concatenated String to convert. May be null or empty.
      Returns:
      The ordered Set represented by the passed string. Never null. If the passed input string is null or "" an empty list is returned.
    • getExplodedToSortedSet

      @ReturnsMutableCopy public static @NonNull TreeSet<String> getExplodedToSortedSet(@NonNull String sSep, @Nullable String sElements)
      Take a concatenated String and return a sorted TreeSet of all elements in the passed string, using specified separator string.
      Parameters:
      sSep - The separator to use. May not be null.
      sElements - The concatenated String to convert. May be null or empty.
      Returns:
      The sorted Set represented by the passed string. Never null. If the passed input string is null or "" an empty list is returned.
    • getConcatenatedOnDemand

      public static @NonNull String getConcatenatedOnDemand(@Nullable String sFront, @Nullable String sEnd)
      Concatenate the strings sFront and sEnd. If either front or back is null or empty only the other element is returned. If both strings are null or empty and empty String is returned.
      Parameters:
      sFront - Front string. May be null.
      sEnd - May be null.
      Returns:
      The concatenated string. Never null.
    • getConcatenatedOnDemand

      public static @NonNull String getConcatenatedOnDemand(@Nullable String sFront, @Nullable String sSep, @Nullable String sEnd)
      Concatenate the strings sFront and sEnd by the "sSep" string. If either front or back is null or empty, the separator is not applied.
      Parameters:
      sFront - Front string. May be null.
      sSep - Separator string. May be null.
      sEnd - May be null.
      Returns:
      The concatenated string.
    • getConcatenatedOnDemand

      public static @NonNull String getConcatenatedOnDemand(@Nullable String sFront, char cSep, @Nullable String sEnd)
      Concatenate the strings sFront and sEnd by the "cSep" separator. If either front or back is null or empty, the separator is not applied.
      Parameters:
      sFront - Front string. May be null.
      cSep - Separator character.
      sEnd - May be null.
      Returns:
      The concatenated string.
    • getQuoted

      public static @NonNull String getQuoted(@Nullable String sSource)
      Get the provided string quoted or unquoted if it is null.
      Parameters:
      sSource - Source string. May be null.
      Returns:
      The String "null" if the source is null, "'" + sSource + "'" otherwise.
      Since:
      9.2.0
    • appendQuoted

      public static void appendQuoted(@NonNull StringBuilder aTarget, @Nullable String sSource)
      Append the provided string quoted or unquoted if it is null.
      Parameters:
      aTarget - The target to write to. May not be null.
      sSource - Source string. May be null.
      Since:
      9.2.0
      See Also:
    • appendQuoted

      public static void appendQuoted(@NonNull Appendable aTarget, @Nullable String sSource) throws IOException
      Append the provided string quoted or unquoted if it is null.
      Parameters:
      aTarget - The target to write to. May not be null.
      sSource - Source string. May be null.
      Throws:
      IOException - in case of IO error
      Since:
      9.2.0
      See Also:
    • trimLeadingWhitespaces

      @CheckReturnValue public static @Nullable String trimLeadingWhitespaces(@Nullable String s)
      Remove any leading whitespaces from the passed string.
      Parameters:
      s - the String to be trimmed
      Returns:
      the original String with all leading whitespaces removed
    • trimTrailingWhitespaces

      @CheckReturnValue public static @Nullable String trimTrailingWhitespaces(@Nullable String s)
      Remove any trailing whitespaces from the passed string.
      Parameters:
      s - the String to be cut
      Returns:
      the original String with all trailing whitespaces removed
    • trimStart

      @CheckReturnValue public static @Nullable String trimStart(@Nullable String sSrc, @Nullable String sLead)
      Trim the passed lead from the source value. If the source value does not start with the passed lead, nothing happens.
      Parameters:
      sSrc - The input source string
      sLead - The string to be trimmed of the beginning
      Returns:
      The trimmed string, or the original input string, if the lead was not found
      See Also:
    • trimStartRepeatedly

      @CheckReturnValue public static @Nullable String trimStartRepeatedly(@Nullable String sSrc, @Nullable String sLead)
      Trim the passed lead from the source value repeatedly until the source no longer starts with the lead. If the source value does not start with the passed lead, nothing happens.
      Parameters:
      sSrc - The input source string. May be null.
      sLead - The string to be trimmed of the beginning repeatedly. May be null.
      Returns:
      The trimmed string, or the original input string, if the lead was not found.
      See Also:
    • trimStart

      @CheckReturnValue public static @Nullable String trimStart(@Nullable String sSrc, char cLead)
      Trim the passed lead from the source value. If the source value does not start with the passed lead, nothing happens.
      Parameters:
      sSrc - The input source string
      cLead - The char to be trimmed of the beginning
      Returns:
      The trimmed string, or the original input string, if the lead was not found
      See Also:
    • trimStartRepeatedly

      @CheckReturnValue public static @Nullable String trimStartRepeatedly(@Nullable String sSrc, char cLead)
      Trim the passed lead character from the source value repeatedly until the source no longer starts with the lead. If the source value does not start with the passed lead, nothing happens.
      Parameters:
      sSrc - The input source string. May be null.
      cLead - The character to be trimmed of the beginning repeatedly.
      Returns:
      The trimmed string, or the original input string, if the lead was not found.
      See Also:
    • trimStart

      @CheckReturnValue public static @Nullable String trimStart(@Nullable String sSrc, @Nonnegative int nCount)
      Trim the passed lead from the source value. If the source value does not start with the passed lead, nothing happens.
      Parameters:
      sSrc - The input source string
      nCount - The number of characters to trim at the end.
      Returns:
      The trimmed string, or an empty string if nCount is ≥ the length of the source string
    • trimEnd

      @CheckReturnValue public static @Nullable String trimEnd(@Nullable String sSrc, @Nullable String sTail)
      Trim the passed tail from the source value. If the source value does not end with the passed tail, nothing happens.
      Parameters:
      sSrc - The input source string
      sTail - The string to be trimmed of the end
      Returns:
      The trimmed string, or the original input string, if the tail was not found
      See Also:
    • trimEndRepeatedly

      @CheckReturnValue public static @Nullable String trimEndRepeatedly(@Nullable String sSrc, @Nullable String sTail)
      Trim the passed tail from the source value repeatedly until the source no longer ends with the tail. If the source value does not end with the passed tail, nothing happens.
      Parameters:
      sSrc - The input source string. May be null.
      sTail - The string to be trimmed of the end repeatedly. May be null.
      Returns:
      The trimmed string, or the original input string, if the tail was not found.
      See Also:
    • trimEnd

      @CheckReturnValue public static @Nullable String trimEnd(@Nullable String sSrc, char cTail)
      Trim the passed tail from the source value. If the source value does not end with the passed tail, nothing happens.
      Parameters:
      sSrc - The input source string
      cTail - The char to be trimmed of the end
      Returns:
      The trimmed string, or the original input string, if the tail was not found
      See Also:
    • trimEndRepeatedly

      @CheckReturnValue public static @Nullable String trimEndRepeatedly(@Nullable String sSrc, char cTail)
      Trim the passed tail character from the source value repeatedly until the source no longer ends with the tail. If the source value does not end with the passed tail, nothing happens.
      Parameters:
      sSrc - The input source string. May be null.
      cTail - The character to be trimmed of the end repeatedly.
      Returns:
      The trimmed string, or the original input string, if the tail was not found.
      See Also:
    • trimEnd

      @CheckReturnValue public static @Nullable String trimEnd(@Nullable String sSrc, @Nonnegative int nCount)
      Trim the passed tail from the source value. If the source value does not end with the passed tail, nothing happens.
      Parameters:
      sSrc - The input source string
      nCount - The number of characters to trim at the end.
      Returns:
      The trimmed string, or an empty string if nCount is ≥ the length of the source string
    • trimStartAndEnd

      @CheckReturnValue public static @Nullable String trimStartAndEnd(@Nullable String sSrc, @Nullable String sValueToTrim)
      Trim the passed lead and tail from the source value. If the source value does not start with the passed trimmed value, nothing happens.
      Parameters:
      sSrc - The input source string
      sValueToTrim - The string to be trimmed of the beginning and the end
      Returns:
      The trimmed string, or the original input string, if the value to trim was not found
      See Also:
    • trimStartAndEnd

      @CheckReturnValue public static @Nullable String trimStartAndEnd(@Nullable String sSrc, @Nullable String sLead, @Nullable String sTail)
      Trim the passed lead and tail from the source value. If the source value does not start with the passed lead and does not end with the passed tail, nothing happens.
      Parameters:
      sSrc - The input source string
      sLead - The string to be trimmed of the beginning
      sTail - The string to be trimmed of the end
      Returns:
      The trimmed string, or the original input string, if the lead and the tail were not found
      See Also:
    • trimStartAndEnd

      @CheckReturnValue public static @Nullable String trimStartAndEnd(@Nullable String sSrc, char cValueToTrim)
      Trim the passed lead and tail from the source value. If the source value does not start with the passed trimmed value, nothing happens.
      Parameters:
      sSrc - The input source string
      cValueToTrim - The char to be trimmed of the beginning and the end
      Returns:
      The trimmed string, or the original input string, if the value to trim was not found
      See Also:
    • trimStartAndEnd

      @CheckReturnValue public static @Nullable String trimStartAndEnd(@Nullable String sSrc, char cLead, char cTail)
      Trim the passed lead and tail from the source value. If the source value does not start with the passed lead and does not end with the passed tail, nothing happens.
      Parameters:
      sSrc - The input source string
      cLead - The char to be trimmed of the beginning
      cTail - The char to be trimmed of the end
      Returns:
      The trimmed string, or the original input string, if the lead and the tail were not found
      See Also:
    • trim

      @CheckReturnValue public static @Nullable String trim(@Nullable String s)
      Trim the passed string, if it is not null.
      Parameters:
      s - The string to be trimmed. May be null.
      Returns:
      null if the input string was null, the non-null trimmed string otherwise.
      See Also:
    • getCutAfterLength

      public static @NonNull String getCutAfterLength(@NonNull String sValue, @Nonnegative int nMaxLength)
      Cut the passed string after the specified length.
      Parameters:
      sValue - The value to be cut. May not be null.
      nMaxLength - The maximum number of characters to keep. Must be ≥ 0.
      Returns:
      The original string if it is shorter than or equal to the max length, otherwise the string cut after the specified length. Never null.
      See Also:
    • getCutAfterLength

      public static @NonNull String getCutAfterLength(@NonNull String sValue, @Nonnegative int nMaxLength, @Nullable String sNewSuffix)
      Cut the passed string after the specified length, optionally appending a suffix (e.g. "...").
      Parameters:
      sValue - The value to be cut. May not be null.
      nMaxLength - The maximum number of characters to keep. Must be ≥ 0.
      sNewSuffix - An optional suffix to append if the string was cut. May be null.
      Returns:
      The original string if it is shorter than or equal to the max length, otherwise the string cut after the specified length with the optional suffix appended. Never null.
    • getToString

      public static @NonNull String getToString(@Nullable Object aObject)
      Convert the passed object to a string using the Object.toString() method.
      Parameters:
      aObject - The value to be converted. May be null.
      Returns:
      An empty string in case the passed object was null. Never null.
      See Also:
    • getToString

      public static @Nullable String getToString(@Nullable Object aObject, @Nullable String sNullValue)
      Convert the passed object to a string using the Object.toString() method or otherwise return the passed default value.
      Parameters:
      aObject - The value to be converted. May be null.
      sNullValue - The value to be returned in case the passed object is null. May be null itself.
      Returns:
      The passed default value in case the passed object was null or the result of Object.toString() on the passed object.
      See Also:
    • getWithoutLeadingChar

      public static @NonNull String getWithoutLeadingChar(@Nullable String sStr)
      Get the passed string without the first char.
      Parameters:
      sStr - The source string. May be null.
      Returns:
      An empty, non-null string if the passed string has a length ≤ 1.
    • getWithoutLeadingChars

      public static @NonNull String getWithoutLeadingChars(@Nullable String sStr, @Nonnegative int nCount)
      Get the passed string without the specified number of leading chars.
      Parameters:
      sStr - The source string. May be null.
      nCount - The number of chars to remove.
      Returns:
      An empty, non-null string if the passed string has a length ≤ nCount.
    • getWithoutTrailingChar

      public static @NonNull String getWithoutTrailingChar(@Nullable String sStr)
      Get the passed string without the last char.
      Parameters:
      sStr - The source string. May be null.
      Returns:
      An empty, non-null string if the passed string has a length ≤ 1.
    • getWithoutTrailingChars

      public static @NonNull String getWithoutTrailingChars(@Nullable String sStr, @Nonnegative int nCount)
      Get the passed string without the specified number of trailing chars.
      Parameters:
      sStr - The source string. May be null.
      nCount - The number of chars to remove.
      Returns:
      An empty, non-null string if the passed string has a length ≤ nCount.
    • getWithoutAnySpaces

      public static @NonNull String getWithoutAnySpaces(@Nullable String sStr)
      Get the passed string where all spaces (white spaces or unicode spaces) have been removed.
      Parameters:
      sStr - The source string. May be null
      Returns:
      A non-null string representing the passed string without any spaces
    • getUntilFirstIncl

      public static @Nullable String getUntilFirstIncl(@Nullable String sStr, char cSearch)
      Get everything from the string up to and including the first passed char.
      Parameters:
      sStr - The source string. May be null.
      cSearch - The character to search.
      Returns:
      null if the passed string does not contain the search character.
    • getUntilFirstExcl

      public static @Nullable String getUntilFirstExcl(@Nullable String sStr, char cSearch)
      Get everything from the string up to and excluding first the passed char.
      Parameters:
      sStr - The source string. May be null.
      cSearch - The character to search.
      Returns:
      null if the passed string does not contain the search character.
    • getUntilFirstIncl

      public static @Nullable String getUntilFirstIncl(@Nullable String sStr, @Nullable String sSearch)
      Get everything from the string up to and including the first passed string.
      Parameters:
      sStr - The source string. May be null.
      sSearch - The string to search. May be null.
      Returns:
      null if the passed string does not contain the search string. If the search string is empty, the empty string is returned.
    • getUntilFirstExcl

      public static @Nullable String getUntilFirstExcl(@Nullable String sStr, @Nullable String sSearch)
      Get everything from the string up to and excluding the first passed string.
      Parameters:
      sStr - The source string. May be null.
      sSearch - The string to search. May be null.
      Returns:
      null if the passed string does not contain the search string. If the search string is empty, the empty string is returned.
    • getUntilLastIncl

      public static @Nullable String getUntilLastIncl(@Nullable String sStr, char cSearch)
      Get everything from the string up to and including the first passed char.
      Parameters:
      sStr - The source string. May be null.
      cSearch - The character to search.
      Returns:
      null if the passed string does not contain the search character.
    • getUntilLastExcl

      public static @Nullable String getUntilLastExcl(@Nullable String sStr, char cSearch)
      Get everything from the string up to and excluding first the passed char.
      Parameters:
      sStr - The source string. May be null.
      cSearch - The character to search.
      Returns:
      null if the passed string does not contain the search character.
    • getUntilLastIncl

      public static @Nullable String getUntilLastIncl(@Nullable String sStr, @Nullable String sSearch)
      Get everything from the string up to and including the first passed string.
      Parameters:
      sStr - The source string. May be null.
      sSearch - The string to search. May be null.
      Returns:
      null if the passed string does not contain the search string. If the search string is empty, the empty string is returned.
    • getUntilLastExcl

      public static @Nullable String getUntilLastExcl(@Nullable String sStr, @Nullable String sSearch)
      Get everything from the string up to and excluding the first passed string.
      Parameters:
      sStr - The source string. May be null.
      sSearch - The string to search. May be null.
      Returns:
      null if the passed string does not contain the search string. If the search string is empty, the empty string is returned.
    • getFromFirstIncl

      public static @Nullable String getFromFirstIncl(@Nullable String sStr, char cSearch)
      Get everything from the string from and including the first passed char.
      Parameters:
      sStr - The source string. May be null.
      cSearch - The character to search.
      Returns:
      null if the passed string does not contain the search character.
    • getFromFirstExcl

      public static @Nullable String getFromFirstExcl(@Nullable String sStr, char cSearch)
      Get everything from the string from and excluding the first passed char.
      Parameters:
      sStr - The source string. May be null.
      cSearch - The character to search.
      Returns:
      null if the passed string does not contain the search character.
    • getFromFirstIncl

      public static @Nullable String getFromFirstIncl(@Nullable String sStr, @Nullable String sSearch)
      Get everything from the string from and including the passed string.
      Parameters:
      sStr - The source string. May be null.
      sSearch - The string to search. May be null.
      Returns:
      null if the passed string does not contain the search string. If the search string is empty, the input string is returned unmodified.
    • getFromFirstExcl

      public static @Nullable String getFromFirstExcl(@Nullable String sStr, @Nullable String sSearch)
      Get everything from the string from and excluding the passed string.
      Parameters:
      sStr - The source string. May be null.
      sSearch - The string to search. May be null.
      Returns:
      null if the passed string does not contain the search string. If the search string is empty, the input string is returned unmodified.
    • getFromLastIncl

      public static @Nullable String getFromLastIncl(@Nullable String sStr, char cSearch)
      Get everything from the string from and including the first passed char.
      Parameters:
      sStr - The source string. May be null.
      cSearch - The character to search.
      Returns:
      null if the passed string does not contain the search character.
    • getFromLastExcl

      public static @Nullable String getFromLastExcl(@Nullable String sStr, char cSearch)
      Get everything from the string from and excluding the first passed char.
      Parameters:
      sStr - The source string. May be null.
      cSearch - The character to search.
      Returns:
      null if the passed string does not contain the search character.
    • getFromLastIncl

      public static @Nullable String getFromLastIncl(@Nullable String sStr, @Nullable String sSearch)
      Get everything from the string from and including the passed string.
      Parameters:
      sStr - The source string. May be null.
      sSearch - The string to search. May be null.
      Returns:
      null if the passed string does not contain the search string. If the search string is empty, the input string is returned unmodified.
    • getFromLastExcl

      public static @Nullable String getFromLastExcl(@Nullable String sStr, @Nullable String sSearch)
      Get everything from the string from and excluding the passed string.
      Parameters:
      sStr - The source string. May be null.
      sSearch - The string to search. May be null.
      Returns:
      null if the passed string does not contain the search string. If the search string is empty, the input string is returned unmodified.
    • getFirstToken

      public static @Nullable String getFirstToken(@Nullable String sStr, char cSearch)
      Get the first token up to (and excluding) the separating character.
      Parameters:
      sStr - The string to search. May be null.
      cSearch - The search character.
      Returns:
      The passed string if no such separator token was found.
    • getFirstToken

      public static @Nullable String getFirstToken(@Nullable String sStr, @Nullable String sSearch)
      Get the first token up to (and excluding) the separating string.
      Parameters:
      sStr - The string to search. May be null.
      sSearch - The search string. May be null.
      Returns:
      The passed string if no such separator token was found.
    • getLastToken

      public static @Nullable String getLastToken(@Nullable String sStr, char cSearch)
      Get the last token from (and excluding) the separating character.
      Parameters:
      sStr - The string to search. May be null.
      cSearch - The search character.
      Returns:
      The passed string if no such separator token was found.
    • getLastToken

      public static @Nullable String getLastToken(@Nullable String sStr, @Nullable String sSearch)
      Get the last token from (and excluding) the separating string.
      Parameters:
      sStr - The string to search. May be null.
      sSearch - The search string. May be null.
      Returns:
      The passed string if no such separator token was found.