Class Strings

java.lang.Object
com.landawn.abacus.util.Strings
Direct Known Subclasses:
Strings.StringUtil

public abstract sealed class Strings extends Object permits Strings.StringUtil

Note: This class includes codes copied from Apache Commons Lang, Google Guava and other open source projects under the Apache License 2.0. The methods copied from other libraries/frameworks/projects may be modified in this class.

See Also:
  • Field Details

  • Method Details

    • guid

      public static String guid()
      Returns a new UUID String without '-'.
      Returns:
    • uuid

      public static String uuid()
      Returns a new UUID String UUID.
      Returns:
    • valueOf

      public static String valueOf(char[] value)
      Returns the string representation of the char array or null.
      Parameters:
      value - the character array.
      Returns:
      a String or null
      Since:
      3.9
      See Also:
    • isValidJavaIdentifier

      public static boolean isValidJavaIdentifier(String str)
      Parameters:
      str -
      Returns:
    • isValidEmailAddress

      public static boolean isValidEmailAddress(String str)
      Parameters:
      str -
      Returns:
      See Also:
    • isValidUrl

      public static boolean isValidUrl(String str)
      Parameters:
      str -
      Returns:
    • isValidHttpUrl

      public static boolean isValidHttpUrl(String str)
      Parameters:
      str -
      Returns:
    • isEmpty

      public static boolean isEmpty(CharSequence cs)
      Checks if the specified CharSequence is null or empty.
      Parameters:
      cs -
      Returns:
    • isBlank

      public static boolean isBlank(CharSequence cs)
      Checks if the specified CharSequence is null or blank.
      Parameters:
      cs -
      Returns:
    • isNotEmpty

      public static boolean isNotEmpty(CharSequence cs)
      Parameters:
      cs -
      Returns:
    • isNotBlank

      @Beta public static boolean isNotBlank(CharSequence cs)
      Parameters:
      cs -
      Returns:
    • isAllEmpty

      public static boolean isAllEmpty(CharSequence a, CharSequence b)
    • isAllEmpty

      public static boolean isAllEmpty(CharSequence a, CharSequence b, CharSequence c)
    • isAllEmpty

      public static boolean isAllEmpty(CharSequence... css)

      Checks if all of the CharSequences are empty ("") or null.

       Strings.isAllEmpty(null)             = true
       Strings.isAllEmpty(null, "")         = true
       Strings.isAllEmpty(new String[] {})  = true
       Strings.isAllEmpty(null, "foo")      = false
       Strings.isAllEmpty("", "bar")        = false
       Strings.isAllEmpty("bob", "")        = false
       Strings.isAllEmpty("  bob  ", null)  = false
       Strings.isAllEmpty(" ", "bar")       = false
       Strings.isAllEmpty("foo", "bar")     = false
       
      Parameters:
      css - the CharSequences to check, may be null or empty
      Returns:
      true if all of the CharSequences are empty or null
      Since:
      3.6
      See Also:
      • Strings#allEmpty(CharSequence...)
    • isAllEmpty

      public static boolean isAllEmpty(Collection<? extends CharSequence> css)
      Parameters:
      css -
      Returns:
      See Also:
      • Strings#allEmpty(Collection)
    • isAllBlank

      public static boolean isAllBlank(CharSequence a, CharSequence b)
    • isAllBlank

      public static boolean isAllBlank(CharSequence a, CharSequence b, CharSequence c)
    • isAllBlank

      public static boolean isAllBlank(CharSequence... css)

      Checks if all of the CharSequences are empty (""), null or whitespace only.

      Whitespace is defined by Character.isWhitespace(char).

       Strings.isAllBlank(null)             = true
       Strings.isAllBlank(null, "foo")      = false
       Strings.isAllBlank(null, null)       = true
       Strings.isAllBlank("", "bar")        = false
       Strings.isAllBlank("bob", "")        = false
       Strings.isAllBlank("  bob  ", null)  = false
       Strings.isAllBlank(" ", "bar")       = false
       Strings.isAllBlank("foo", "bar")     = false
       Strings.isAllBlank(new String[] {})  = true
       
      Parameters:
      css - the CharSequences to check, may be null or empty
      Returns:
      true if all of the CharSequences are empty or null or whitespace only
      Since:
      3.6
      See Also:
      • Strings#allBlank(CharSequence...)
    • isAllBlank

      public static boolean isAllBlank(Collection<? extends CharSequence> css)
      Parameters:
      css -
      Returns:
      See Also:
      • Strings#allBlank(Collection)
    • isAnyEmpty

      public static boolean isAnyEmpty(CharSequence a, CharSequence b)
    • isAnyEmpty

      public static boolean isAnyEmpty(CharSequence a, CharSequence b, CharSequence c)
    • isAnyEmpty

      public static boolean isAnyEmpty(CharSequence... css)

      Checks if any of the CharSequences are empty ("") or null.

       Strings.isAnyEmpty((String) null)    = true
       Strings.isAnyEmpty((String[]) null)  = false
       Strings.isAnyEmpty(null, "foo")      = true
       Strings.isAnyEmpty("", "bar")        = true
       Strings.isAnyEmpty("bob", "")        = true
       Strings.isAnyEmpty("  bob  ", null)  = true
       Strings.isAnyEmpty(" ", "bar")       = false
       Strings.isAnyEmpty("foo", "bar")     = false
       Strings.isAnyEmpty(new String[]{})   = false
       Strings.isAnyEmpty(new String[]{""}) = true
       
      Parameters:
      css - the CharSequences to check, may be null or empty
      Returns:
      true if any of the CharSequences are empty or null
      Since:
      3.2
      See Also:
      • Strings#anyEmpty(CharSequence...)
    • isAnyEmpty

      public static boolean isAnyEmpty(Collection<? extends CharSequence> css)
      Parameters:
      css -
      Returns:
      See Also:
      • Strings#anyEmpty(CharSequence...)
    • isAnyBlank

      public static boolean isAnyBlank(CharSequence a, CharSequence b)
    • isAnyBlank

      public static boolean isAnyBlank(CharSequence a, CharSequence b, CharSequence c)
    • isAnyBlank

      public static boolean isAnyBlank(CharSequence... css)

      Checks if any of the CharSequences are empty ("") or null or whitespace only.

      Whitespace is defined by Character.isWhitespace(char).

       Strings.isAnyBlank((String) null)    = true
       Strings.isAnyBlank((String[]) null)  = false
       Strings.isAnyBlank(null, "foo")      = true
       Strings.isAnyBlank(null, null)       = true
       Strings.isAnyBlank("", "bar")        = true
       Strings.isAnyBlank("bob", "")        = true
       Strings.isAnyBlank("  bob  ", null)  = true
       Strings.isAnyBlank(" ", "bar")       = true
       Strings.isAnyBlank(new String[] {})  = false
       Strings.isAnyBlank(new String[]{""}) = true
       Strings.isAnyBlank("foo", "bar")     = false
       
      Parameters:
      css - the CharSequences to check, may be null or empty
      Returns:
      true if any of the CharSequences are empty or null or whitespace only
      Since:
      3.2
      See Also:
      • Strings#anyBlank(CharSequence...)
    • isAnyBlank

      public static boolean isAnyBlank(Collection<? extends CharSequence> css)
      Parameters:
      css -
      Returns:
      See Also:
      • Strings#anyBlank(Collection)
    • firstNonEmpty

      public static <T extends CharSequence> T firstNonEmpty(T a, T b)
      Type Parameters:
      T -
      Parameters:
      a -
      b -
      Returns:
      the first value from specified parameters which is not empty, or null if there are no non-empty values
      See Also:
    • firstNonEmpty

      public static <T extends CharSequence> T firstNonEmpty(T a, T b, T c)
      Type Parameters:
      T -
      Parameters:
      a -
      b -
      c -
      Returns:
      the first value from specified parameters which is not empty, or null if there are no non-empty values
      See Also:
    • firstNonEmpty

      @MayReturnNull @SafeVarargs public static <T extends CharSequence> T firstNonEmpty(T... css)

      Returns the first value in the array which is not empty.

      If all values are empty or the array is null or empty then null is returned.

       Strings.firstNonEmpty(null, null, null)   = null
       Strings.firstNonEmpty(null, null, "")     = null
       Strings.firstNonEmpty(null, "", " ")      = " "
       Strings.firstNonEmpty("abc")              = "abc"
       Strings.firstNonEmpty(null, "xyz")        = "xyz"
       Strings.firstNonEmpty("", "xyz")          = "xyz"
       Strings.firstNonEmpty(null, "xyz", "abc") = "xyz"
       Strings.firstNonEmpty()                   = null
       
      Type Parameters:
      T - the specific kind of CharSequence
      Parameters:
      css - the values to test, may be null or empty
      Returns:
      the first value from css which is not empty, or null if there is no non-empty value.
      Since:
      3.8
      See Also:
    • firstNonEmpty

      @MayReturnNull public static <T extends CharSequence> T firstNonEmpty(Collection<? extends T> css)
      Type Parameters:
      T -
      Parameters:
      css -
      Returns:
      the first value from css which is not empty, or null if there is no non-empty value.
      See Also:
    • firstNonBlank

      public static <T extends CharSequence> T firstNonBlank(T a, T b)
      Type Parameters:
      T -
      Parameters:
      a -
      b -
      Returns:
      the first value from specified parameters which is not blank, or null if there are no non-blank values
      See Also:
    • firstNonBlank

      public static <T extends CharSequence> T firstNonBlank(T a, T b, T c)
      Type Parameters:
      T -
      Parameters:
      a -
      b -
      c -
      Returns:
      the first value from specified parameters which is not blank, or null if there are no non-blank values
      See Also:
    • firstNonBlank

      @MayReturnNull @SafeVarargs public static <T extends CharSequence> T firstNonBlank(T... css)
      Type Parameters:
      T -
      Parameters:
      css -
      Returns:
      the first value from css which is not empty, or null if there is no non-blank value.
      See Also:
    • firstNonBlank

      @MayReturnNull public static <T extends CharSequence> T firstNonBlank(Collection<? extends T> css)
      Type Parameters:
      T -
      Parameters:
      css -
      Returns:
      the first value from css which is not empty, or null if there is no non-blank value.
      See Also:
    • defaultIfEmpty

      public static <T extends CharSequence> T defaultIfEmpty(T str, T defaultStr)
      Same as N.defaultIfEmpty(CharSequence, CharSequence).
      Type Parameters:
      T -
      Parameters:
      str -
      defaultStr -
      Returns:
      See Also:
    • defaultIfEmpty

      public static <T extends CharSequence> T defaultIfEmpty(T str, Supplier<? extends T> getterForDefaultStr)
      Type Parameters:
      T -
      Parameters:
      str -
      getterForDefaultStr -
      Returns:
    • defaultIfBlank

      public static <T extends CharSequence> T defaultIfBlank(T str, T defaultStr)
      Same as N.defaultIfBlank(CharSequence, CharSequence).
      Type Parameters:
      T -
      Parameters:
      str -
      defaultStr -
      Returns:
      See Also:
    • defaultIfBlank

      public static <T extends CharSequence> T defaultIfBlank(T str, Supplier<? extends T> getterForDefaultStr)
      Type Parameters:
      T -
      Parameters:
      str -
      getterForDefaultStr -
      Returns:
    • nullToEmpty

      public static String nullToEmpty(String str)
      Converts the specified String to an empty String "" if it's null, otherwise just returns itself.
      Parameters:
      str -
      Returns:
    • nullToEmpty

      public static void nullToEmpty(String[] strs)
      Converts each null String element in the specified String array to an empty String "".
      Parameters:
      strs -
      See Also:
      • CommonUtil.nullToEmpty(String[])
      • CommonUtil.nullToEmptyForEach(String[])
    • emptyToNull

      public static String emptyToNull(String str)
      Parameters:
      str -
      Returns:
    • emptyToNull

      public static void emptyToNull(String[] strs)
      Parameters:
      strs -
    • blankToEmpty

      public static String blankToEmpty(String str)
      Parameters:
      str -
      Returns:
    • blankToEmpty

      public static void blankToEmpty(String[] strs)
      Parameters:
      strs -
    • blankToNull

      public static String blankToNull(String str)
      Parameters:
      str -
      Returns:
    • blankToNull

      public static void blankToNull(String[] strs)
      Parameters:
      strs -
    • abbreviate

      public static String abbreviate(String str, int maxWidth)

      Abbreviates a String using ellipses. This will turn "Now is the time for all good men" into "Now is the time for..."

      Specifically:

      • If the number of characters in str is less than or equal to maxWidth, return str.
      • Else abbreviate it to (substring(str, 0, max-3) + "...").
      • If maxWidth is less than 4, throw an IllegalArgumentException.
      • In no case will it return a String of length greater than maxWidth.
       Strings.abbreviate(null, 4)        = null
       Strings.abbreviate("", 4)        = ""
       Strings.abbreviate("abcdefg", 6) = "abc..."
       Strings.abbreviate("abcdefg", 7) = "abcdefg"
       Strings.abbreviate("abcdefg", 8) = "abcdefg"
       Strings.abbreviate("abcdefg", 4) = "a..."
       Strings.abbreviate("abcdefg", 3) = IllegalArgumentException
       
      Parameters:
      str - the String to check, may be null
      maxWidth - maximum length of result String, must be at least 4
      Returns:
      abbreviated String
      Throws:
      IllegalArgumentException - if the width is too small
      Since:
      2.0
    • abbreviate

      public static String abbreviate(String str, String abbrevMarker, int maxWidth)

      Abbreviates a String using another given String as replacement marker. This will turn "Now is the time for all good men" into "Now is the time for..." if "..." was defined as the replacement marker.

      Specifically:

      • If the number of characters in str is less than or equal to maxWidth, return str.
      • Else abbreviate it to (substring(str, 0, max-abbrevMarker.length) + abbrevMarker).
      • If maxWidth is less than abbrevMarker.length + 1, throw an IllegalArgumentException.
      • In no case will it return a String of length greater than maxWidth.
       Strings.abbreviate(null, "...", 4)        = null
       Strings.abbreviate("", "...", 4)        = ""
       Strings.abbreviate("abcdefg", null, *)  = "abcdefg"
       Strings.abbreviate("abcdefg", ".", 5)   = "abcd."
       Strings.abbreviate("abcdefg", ".", 7)   = "abcdefg"
       Strings.abbreviate("abcdefg", ".", 8)   = "abcdefg"
       Strings.abbreviate("abcdefg", "..", 4)  = "ab.."
       Strings.abbreviate("abcdefg", "..", 3)  = "a.."
       Strings.abbreviate("abcdefg", "..", 2)  = IllegalArgumentException
       Strings.abbreviate("abcdefg", "...", 3) = IllegalArgumentException
       
      Parameters:
      str - the String to check, may be null
      abbrevMarker - the String used as replacement marker
      maxWidth - maximum length of result String, must be at least abbrevMarker.length + 1
      Returns:
      abbreviated String
      Throws:
      IllegalArgumentException - if the width is too small
      Since:
      3.6
    • abbreviateMiddle

      public static String abbreviateMiddle(String str, String middle, int length)

      Abbreviates a String to the length passed, replacing the middle characters with the supplied replacement String.

      This abbreviation only occurs if the following criteria is met:

      • Neither the String for abbreviation nor the replacement String are null or empty
      • The length to truncate to is less than the length of the supplied String
      • The length to truncate to is greater than 0
      • The abbreviated String will have enough room for the length supplied replacement String and the first and last characters of the supplied String for abbreviation

      Otherwise, the returned String will be the same as the supplied String for abbreviation.

       Strings.abbreviateMiddle(null, null, 0)      = null
       Strings.abbreviateMiddle("abc", null, 0)      = "abc"
       Strings.abbreviateMiddle("abc", ".", 0)      = "abc"
       Strings.abbreviateMiddle("abc", ".", 3)      = "abc"
       Strings.abbreviateMiddle("abcdef", ".", 4)     = "ab.f"
       
      Parameters:
      str - the String to abbreviate, may be null
      middle - the String to replace the middle characters with, may be null
      length - the length to abbreviate str to.
      Returns:
      the abbreviated String if the above criteria is met, or the original String supplied for abbreviation.
      Since:
      2.5
    • center

      public static String center(String str, int size)

      Centers a String in a larger String of size size using the space character (' ').

      If the size is less than the String length, the original String is returned.

      Equivalent to center(str, size, " ").

       Strings.center(null, 4)     = "    "
       Strings.center("", 4)     = "    "
       Strings.center("ab", 4)   = " ab "
       Strings.center("abcd", 2) = "abcd"
       Strings.center("a", 4)    = " a  "
       
      Parameters:
      str - the String to center, may be null
      size - the int size of new String
      Returns:
      centered String
    • center

      public static String center(String str, int size, char padChar)

      Centers a String in a larger String of size size. Uses a supplied character as the value to pad the String with.

      If the size is less than the String length, the String is returned.

       Strings.center(null, 4, ' ')     = "    "
       Strings.center("", 4, ' ')     = "    "
       Strings.center("ab", 4, ' ')   = " ab "
       Strings.center("abcd", 2, ' ') = "abcd"
       Strings.center("a", 4, ' ')    = " a  "
       Strings.center("a", 4, 'y')    = "yayy"
       
      Parameters:
      str - the String to center, may be null
      size - the int size of new String.
      padChar - the character to pad the new String with
      Returns:
      centered String
      Since:
      2.0
    • center

      public static String center(String str, int minLength, String padStr)

      Centers a String in a larger String of size minLength. Uses a supplied String as the value to pad the String with.

      If the size is less than the String length, the String is returned.

       Strings.center(null, 4, " ")     = "    "
       Strings.center("", 4, " ")     = "    "
       Strings.center("ab", 4, " ")   = " ab "
       Strings.center("abcd", 2, " ") = "abcd"
       Strings.center("a", 4, " ")    = " a  "
       Strings.center("a", 4, "yz")   = "yzayz"
       Strings.center("abc", 7, "")   = "  abc  "
       
      Parameters:
      str - the String to center, may be null
      minLength - the minimum size of new String.
      padStr - the String to pad the new String with, must not be null or empty
      Returns:
      centered String
    • padStart

      public static String padStart(String str, int minLength)
      Parameters:
      str -
      minLength -
      Returns:
    • padStart

      public static String padStart(String str, int minLength, char padChar)
      Parameters:
      str -
      minLength -
      padChar -
      Returns:
      the specified String if its length is bigger than minLength
    • padStart

      public static String padStart(String str, int minLength, String padStr)
      Parameters:
      str -
      minLength -
      padStr -
      Returns:
      the specified String if its length is bigger than minLength
    • padEnd

      public static String padEnd(String str, int minLength)
      Parameters:
      str -
      minLength -
      Returns:
    • padEnd

      public static String padEnd(String str, int minLength, char padChar)
      Parameters:
      str -
      minLength -
      padChar -
      Returns:
      the specified String if its length is bigger than minLength
    • padEnd

      public static String padEnd(String str, int minLength, String padStr)
      Parameters:
      str -
      minLength -
      padStr -
      Returns:
      the specified String if its length is bigger than minLength
    • repeat

      public static String repeat(char ch, int n)
      Parameters:
      ch -
      n -
      Returns:
    • repeat

      public static String repeat(char ch, int n, char delimiter)
      Parameters:
      ch -
      n -
      delimiter -
      Returns:
    • repeat

      public static String repeat(String str, int repeat)
      Parameters:
      str -
      repeat -
      Returns:
    • repeat

      public static String repeat(String str, int n, String delimiter)
      Parameters:
      str -
      n -
      delimiter -
      Returns:
    • repeat

      public static String repeat(String str, int n, String delimiter, String prefix, String suffix)
      Parameters:
      str -
      n -
      delimiter -
      prefix -
      suffix -
      Returns:
    • getBytes

      public static byte[] getBytes(String string)
      Returns the byte array returned by String#getBytes(IOUtil.DEFAULT_CHARSET), or null if the specified String is null.
      Parameters:
      string -
      Returns:
    • getBytes

      public static byte[] getBytes(String string, Charset charset)
      Returns the byte array returned by String#getBytes(Charset), or null if the specified String is null.
      Parameters:
      string -
      charset -
      Returns:
      the encoded bytes
    • toCharArray

      @MayReturnNull public static char[] toCharArray(CharSequence source)
      Returns the char array of the specified CharSequence, or null if the specified String is null.
      Parameters:
      source -
      Returns:
      null if (source == null). (auto-generated java doc for return)
    • toCodePoints

      @MayReturnNull public static int[] toCodePoints(CharSequence str)

      Converts a CharSequence into an array of code points.

      Valid pairs of surrogate code units will be converted into a single supplementary code point. Isolated surrogate code units (i.e. a high surrogate not followed by a low surrogate or a low surrogate not preceded by a high surrogate) will be returned as-is.

       Strings.toCodePoints(null)   =  null
       Strings.toCodePoints("")     =  []  // empty array
       
      Parameters:
      str - the character sequence to convert
      Returns:
      an array of code points. null if (str == null). (auto-generated java doc for return)
      Since:
      3.6
    • toLowerCase

      public static char toLowerCase(char ch)
      To lower case.
      Parameters:
      ch -
      Returns:
    • toLowerCase

      public static String toLowerCase(String str)

      Converts a String to lower case as per String.toLowerCase().

      A null input String returns null.

       Strings.toLowerCase(null)  = null
       Strings.toLowerCase("")    = ""
       Strings.toLowerCase("aBc") = "abc"
       

      Note: As described in the documentation for String.toLowerCase(), the result of this method is affected by the current locale. For platform-independent case transformations, the method toLowerCase(String, Locale) should be used with a specific locale (e.g. Locale.ENGLISH).

      Parameters:
      str - the String to lower case, may be null
      Returns:
      the specified String if it's null or empty.
    • toLowerCase

      public static String toLowerCase(String str, Locale locale)

      Converts a String to lower case as per String.toLowerCase(Locale) .

      A null input String returns null.

       Strings.toLowerCase(null, Locale.ENGLISH)  = null
       Strings.toLowerCase("", Locale.ENGLISH)    = ""
       Strings.toLowerCase("aBc", Locale.ENGLISH) = "abc"
       
      Parameters:
      str - the String to lower case, may be null
      locale - the locale that defines the case transformation rules, must not be null
      Returns:
      the specified String if it's null or empty.
      Since:
      2.5
    • toLowerCaseWithUnderscore

      public static String toLowerCaseWithUnderscore(String str)
      To lower case with underscore.
      Parameters:
      str -
      Returns:
      the specified String if it's null or empty.
    • toUpperCase

      public static char toUpperCase(char ch)
      To upper case.
      Parameters:
      ch -
      Returns:
    • toUpperCase

      public static String toUpperCase(String str)

      Converts a String to upper case as per String.toUpperCase().

      A null input String returns null.

       Strings.toUpperCase(null)  = null
       Strings.toUpperCase("")    = ""
       Strings.toUpperCase("aBc") = "ABC"
       

      Note: As described in the documentation for String.toUpperCase(), the result of this method is affected by the current locale. For platform-independent case transformations, the method toLowerCase(String, Locale) should be used with a specific locale (e.g. Locale.ENGLISH).

      Parameters:
      str - the String to upper case, may be null
      Returns:
      the specified String if it's null or empty.
    • toUpperCase

      public static String toUpperCase(String str, Locale locale)

      Converts a String to upper case as per String.toUpperCase(Locale) .

      A null input String returns null.

       Strings.toUpperCase(null, Locale.ENGLISH)  = null
       Strings.toUpperCase("", Locale.ENGLISH)    = ""
       Strings.toUpperCase("aBc", Locale.ENGLISH) = "ABC"
       
      Parameters:
      str - the String to upper case, may be null
      locale - the locale that defines the case transformation rules, must not be null
      Returns:
      the specified String if it's null or empty.
      Since:
      2.5
    • toUpperCaseWithUnderscore

      public static String toUpperCaseWithUnderscore(String str)
      To upper case with underscore.
      Parameters:
      str -
      Returns:
      the specified String if it's null or empty.
    • toCamelCase

      public static String toCamelCase(String str)
      Parameters:
      str -
      Returns:
      the specified String if it's null or empty.
    • swapCase

      public static char swapCase(char ch)
      Parameters:
      ch -
      Returns:
    • swapCase

      public static String swapCase(String str)

      Swaps the case of a String changing upper and title case to lower case, and lower case to upper case.

      • Upper case character converts to Lower case
      • Title case character converts to Lower case
      • Lower case character converts to Upper case

      For a word based algorithm, see WordUtils.swapCase(String). A null input String returns null.

       Strings.swapCase(null)                 = null
       Strings.swapCase("")                   = ""
       Strings.swapCase("The dog has a BONE") = "tHE DOG HAS A bone"
       

      NOTE: This method changed in Lang version 2.0. It no longer performs a word based algorithm. If you only use ASCII, you will notice no change. That functionality is available in org.apache.commons.lang3.text.WordUtils.

      Parameters:
      str - the String to swap case, may be null
      Returns:
      the specified String if it's null or empty.
    • capitalize

      public static String capitalize(String str)
      Parameters:
      str -
      Returns:
      the specified String if it's null or empty.
    • uncapitalize

      public static String uncapitalize(String str)
      Parameters:
      str -
      Returns:
      the specified String if it's null or empty.
    • quoteEscaped

      public static String quoteEscaped(String str)
      Replace ''' or '"' with '\'' or '\"' if the previous char of the quotation is not '\'. original String is returned if the specified String is null or empty.
      Parameters:
      str -
      Returns:
      the specified String if it's null or empty.
    • quoteEscaped

      public static String quoteEscaped(String str, char quoteChar)
      Parameters:
      str -
      quoteChar - it should be " or '.
      Returns:
      the specified String if it's null or empty.
    • unicodeEscaped

      public static String unicodeEscaped(char ch)

      Converts the char to the unicode format ' '.

      This format is the Java source code format.

         Strings.unicodeEscaped(' ') = " "
         Strings.unicodeEscaped('A') = "A"
       
      Parameters:
      ch - the character to convert
      Returns:
    • normalizeSpace

      public static String normalizeSpace(String str)

      Similar to http://www.w3.org/TR/xpath/#function-normalize -space

      The function returns the argument string with whitespace normalized by using trim(String) to remove leading and trailing whitespace and then replacing sequences of whitespace characters by a single space.

      In XML Whitespace characters are the same as those allowed by the S production, which is S ::= (#x20 | #x9 | #xD | #xA)+

      Java's regexp pattern \s defines whitespace as [ \t\n\x0B\f\r]

      For reference:

      • \x0B = vertical tab
      • \f = #xC = form feed
      • #x20 = space
      • #x9 = \t
      • #xA = \n
      • #xD = \r

      The difference is that Java's whitespace includes vertical tab and form feed, which this functional will also normalize. Additionally trim(String) removes control characters (char <= 32) from both ends of this String.

      Parameters:
      str - the source String to normalize whitespaces from, may be null
      Returns:
      null String input
      Since:
      3.0
      See Also:
    • replaceAll

      public static String replaceAll(String str, String target, String replacement)

      Replaces all occurrences of a String within another String.

      A null reference passed to this method is a no-op.

       Strings.replaceAll(null, *, *)        = null
       Strings.replaceAll("", *, *)          = ""
       Strings.replaceAll("any", null, *)    = "any"
       Strings.replaceAll("any", *, null)    = "any"
       Strings.replaceAll("any", "", *)      = "any"
       Strings.replaceAll("aba", "a", null)  = "b"
       Strings.replaceAll("aba", "a", "")    = "b"
       Strings.replaceAll("aba", "a", "z")   = "zbz"
       
      Parameters:
      str - text to search and replace in, may be null
      target - the String to search for, may be null
      replacement - the String to replace it with, may be null
      Returns:
      String input
      See Also:
      • #replaceAll(String text, String searchString, String replacement, int max)
    • replaceAll

      public static String replaceAll(String str, int fromIndex, String target, String replacement)
      Parameters:
      str -
      fromIndex -
      target -
      replacement -
      Returns:
    • replaceFirst

      public static String replaceFirst(String str, String target, String replacement)

      Replaces a String with another String inside a larger String, once.

      A null reference passed to this method is a no-op.

       Strings.replaceOnce(null, *, *)        = null
       Strings.replaceOnce("", *, *)          = ""
       Strings.replaceOnce("any", null, *)    = "any"
       Strings.replaceOnce("any", *, null)    = "any"
       Strings.replaceOnce("any", "", *)      = "any"
       Strings.replaceOnce("aba", "a", null)  = "ba"
       Strings.replaceOnce("aba", "a", "")    = "ba"
       Strings.replaceOnce("aba", "a", "z")   = "zba"
       
      Parameters:
      str -
      target -
      replacement - the String to replace with, may be null
      Returns:
      the text with any replacements processed, null if null String input
      See Also:
      • #replace(String text, String searchString, String replacement, int max)
    • replaceFirst

      public static String replaceFirst(String str, int fromIndex, String target, String replacement)
      Parameters:
      str -
      fromIndex -
      target -
      replacement -
      Returns:
    • replaceOnce

      @Deprecated public static String replaceOnce(String str, String target, String replacement)
      Deprecated.

      Replaces a String with another String inside a larger String, once.

      A null reference passed to this method is a no-op.

       Strings.replaceOnce(null, *, *)        = null
       Strings.replaceOnce("", *, *)          = ""
       Strings.replaceOnce("any", null, *)    = "any"
       Strings.replaceOnce("any", *, null)    = "any"
       Strings.replaceOnce("any", "", *)      = "any"
       Strings.replaceOnce("aba", "a", null)  = "ba"
       Strings.replaceOnce("aba", "a", "")    = "ba"
       Strings.replaceOnce("aba", "a", "z")   = "zba"
       
      Parameters:
      str -
      target -
      replacement - the String to replace with, may be null
      Returns:
      the text with any replacements processed, null if null String input
      See Also:
      • #replace(String text, String searchString, String replacement, int max)
    • replaceOnce

      @Deprecated public static String replaceOnce(String str, int fromIndex, String target, String replacement)
      Parameters:
      str -
      fromIndex -
      target -
      replacement -
      Returns:
    • replace

      public static String replace(String str, int fromIndex, String target, String replacement, int max)

      Replaces a String with another String inside a larger String, for the first max values of the search String.

      A null reference passed to this method is a no-op.

       replace(null, *, *, *)         = null
       replace("", *, *, *)           = ""
       replace("any", null, *, *)     = "any"
       replace("any", "", *, *)       = "any"
       replace("any", *, *, 0)        = "any"
       replace("abaa", 0, "a", null, -1) = "b"
       replace("abaa", 0, "a", "", -1)   = "b"
       replace("abaa", 0, "a", "z", 0)   = "abaa"
       replace("abaa", 0, "a", "z", 1)   = "zbaa"
       replace("abaa", 0, "a", "z", 2)   = "zbza"
       replace("abaa", 0, "a", "z", -1)  = "zbzz"
       
      Parameters:
      str - text to search and replace in, may be null
      fromIndex -
      target - the String to search for, may be null
      replacement - the String to replace it with, can't be null
      max - maximum number of values to replace, or -1 if no maximum
      Returns:
      String input
    • replaceAllIgnoreCase

      public static String replaceAllIgnoreCase(String str, String target, String replacement)
      Replace all ignore case.
      Parameters:
      str -
      target -
      replacement -
      Returns:
    • replaceAllIgnoreCase

      public static String replaceAllIgnoreCase(String str, int fromIndex, String target, String replacement)
      Replace all ignore case.
      Parameters:
      str -
      fromIndex -
      target -
      replacement -
      Returns:
    • replaceFirstIgnoreCase

      public static String replaceFirstIgnoreCase(String str, String target, String replacement)
      Replace once ignore case.
      Parameters:
      str -
      target -
      replacement -
      Returns:
    • replaceFirstIgnoreCase

      public static String replaceFirstIgnoreCase(String str, int fromIndex, String target, String replacement)
      Replace once ignore case.
      Parameters:
      str -
      fromIndex -
      target -
      replacement -
      Returns:
    • replaceOnceIgnoreCase

      @Deprecated public static String replaceOnceIgnoreCase(String str, String target, String replacement)
      Replace once ignore case.
      Parameters:
      str -
      target -
      replacement -
      Returns:
    • replaceOnceIgnoreCase

      @Deprecated public static String replaceOnceIgnoreCase(String str, int fromIndex, String target, String replacement)
      Replace once ignore case.
      Parameters:
      str -
      fromIndex -
      target -
      replacement -
      Returns:
    • replaceIgnoreCase

      public static String replaceIgnoreCase(String str, int fromIndex, String target, String replacement, int max)
      Replace ignore case.
      Parameters:
      str -
      fromIndex -
      target -
      replacement -
      max -
      Returns:
    • replacePattern

      public static String replacePattern(String source, String regex, String replacement)
      Replaces each substring of the source String that matches the given regular expression with the given replacement using the Pattern.DOTALL option. DOTALL is also know as single-line mode in Perl. This call is also equivalent to:
      • source.replaceAll(&quot;(?s)&quot; + regex, replacement)
      • Pattern.compile(regex, Pattern.DOTALL).filter(source).replaceAll(replacement)
      Parameters:
      source - the source string
      regex - the regular expression to which this string is to be matched
      replacement - the string to be substituted for each match
      Returns:
      The resulting String
      Since:
      3.2
      See Also:
    • removeStart

      public static String removeStart(String str, String removeStr)

      Removes a substring only if it is at the beginning of a source string, otherwise returns the source string.

      A null source string will return null. An empty ("") source string will return the empty string. A null search string will return the source string.

       Strings.removeStart(null, *)      = null
       Strings.removeStart("", *)        = ""
       Strings.removeStart(*, null)      = *
       Strings.removeStart("www.domain.com", "www.")   = "domain.com"
       Strings.removeStart("domain.com", "www.")       = "domain.com"
       Strings.removeStart("www.domain.com", "domain") = "www.domain.com"
       Strings.removeStart("abc", "")    = "abc"
       
      Parameters:
      str - the source String to search, may be null
      removeStr - the String to search for and remove, may be null
      Returns:
      null String input
      Since:
      2.1
    • removeStartIgnoreCase

      public static String removeStartIgnoreCase(String str, String removeStr)

      Case insensitive removal of a substring if it is at the beginning of a source string, otherwise returns the source string.

      A null source string will return null. An empty ("") source string will return the empty string. A null search string will return the source string.

       Strings.removeStartIgnoreCase(null, *)      = null
       Strings.removeStartIgnoreCase("", *)        = ""
       Strings.removeStartIgnoreCase(*, null)      = *
       Strings.removeStartIgnoreCase("www.domain.com", "www.")   = "domain.com"
       Strings.removeStartIgnoreCase("www.domain.com", "WWW.")   = "domain.com"
       Strings.removeStartIgnoreCase("domain.com", "www.")       = "domain.com"
       Strings.removeStartIgnoreCase("www.domain.com", "domain") = "www.domain.com"
       Strings.removeStartIgnoreCase("abc", "")    = "abc"
       
      Parameters:
      str - the source String to search, may be null
      removeStr - the String to search for (case insensitive) and remove, may be null
      Returns:
      the specified String if it's null or empty, or removal String is null or empty.
      Since:
      2.4
    • removeEnd

      public static String removeEnd(String str, String removeStr)

      Removes a substring only if it is at the end of a source string, otherwise returns the source string.

      A null source string will return null. An empty ("") source string will return the empty string. A null search string will return the source string.

       Strings.removeEnd(null, *)      = null
       Strings.removeEnd("", *)        = ""
       Strings.removeEnd(*, null)      = *
       Strings.removeEnd("www.domain.com", ".com.")  = "www.domain.com"
       Strings.removeEnd("www.domain.com", ".com")   = "www.domain"
       Strings.removeEnd("www.domain.com", "domain") = "www.domain.com"
       Strings.removeEnd("abc", "")    = "abc"
       
      Parameters:
      str - the source String to search, may be null
      removeStr - the String to search for and remove, may be null
      Returns:
      the specified String if it's null or empty, or removal String is null or empty.
      Since:
      2.1
    • removeEndIgnoreCase

      public static String removeEndIgnoreCase(String str, String removeStr)

      Case insensitive removal of a substring if it is at the end of a source string, otherwise returns the source string.

      A null source string will return null. An empty ("") source string will return the empty string. A null search string will return the source string.

       Strings.removeEndIgnoreCase(null, *)      = null
       Strings.removeEndIgnoreCase("", *)        = ""
       Strings.removeEndIgnoreCase(*, null)      = *
       Strings.removeEndIgnoreCase("www.domain.com", ".com.")  = "www.domain.com"
       Strings.removeEndIgnoreCase("www.domain.com", ".com")   = "www.domain"
       Strings.removeEndIgnoreCase("www.domain.com", "domain") = "www.domain.com"
       Strings.removeEndIgnoreCase("abc", "")    = "abc"
       Strings.removeEndIgnoreCase("www.domain.com", ".COM") = "www.domain")
       Strings.removeEndIgnoreCase("www.domain.COM", ".com") = "www.domain")
       
      Parameters:
      str - the source String to search, may be null
      removeStr - the String to search for (case insensitive) and remove, may be null
      Returns:
      the specified String if it's null or empty, or removal String is null or empty.
      Since:
      2.4
    • removeAll

      public static String removeAll(String str, char removeChar)

      Removes all occurrences of a character from within the source string.

      A null source string will return null. An empty ("") source string will return the empty string.

       Strings.remove(null, *)       = null
       Strings.remove("", *)         = ""
       Strings.remove("queued", 'u') = "qeed"
       Strings.remove("queued", 'z') = "queued"
       
      Parameters:
      str - the source String to search, may be null
      removeChar - the char to search for and remove, may be null
      Returns:
      the specified String if it's null or empty.
      Since:
      2.1
    • removeAll

      public static String removeAll(String str, int fromIndex, char removeChar)
      Removes the all.
      Parameters:
      str -
      fromIndex -
      removeChar -
      Returns:
      the specified String if it's null or empty.
    • removeAll

      public static String removeAll(String str, String removeStr)

      Removes all occurrences of a substring from within the source string.

      A null source string will return null. An empty ("") source string will return the empty string. A null remove string will return the source string. An empty ("") remove string will return the source string.

       Strings.removeAll(null, *)        = null
       Strings.removeAll("", *)          = ""
       Strings.removeAll(*, null)        = *
       Strings.removeAll(*, "")          = *
       Strings.removeAll("queued", "ue") = "qd"
       Strings.removeAll("queued", "zz") = "queued"
       
      Parameters:
      str - the source String to search, may be null
      removeStr - the String to search for and remove, may be null
      Returns:
      the specified String if it's null or empty.
      Since:
      2.1
    • removeAll

      public static String removeAll(String str, int fromIndex, String removeStr)
      Removes the all.
      Parameters:
      str -
      fromIndex -
      removeStr -
      Returns:
      the specified String if it's null or empty.
    • removePattern

      public static String removePattern(String source, String regex)
      Removes each substring of the source String that matches the given regular expression using the DOTALL option.
      Parameters:
      source - the source string
      regex - the regular expression to which this string is to be matched
      Returns:
      The resulting String
      Since:
      3.2
      See Also:
    • split

      public static String[] split(String str, char delimiter)
      Parameters:
      str -
      delimiter -
      Returns:
    • split

      public static String[] split(String str, char delimiter, boolean trim)
      Parameters:
      str -
      delimiter -
      trim -
      Returns:
    • split

      public static String[] split(String str, String delimiter)
      Parameters:
      str -
      delimiter -
      Returns:
    • split

      public static String[] split(String str, String delimiter, boolean trim)
      Parameters:
      str -
      delimiter -
      trim -
      Returns:
    • split

      public static String[] split(String str, String delimiter, int max)
      Parameters:
      str -
      delimiter -
      max -
      Returns:
    • split

      public static String[] split(String str, String delimiter, int max, boolean trim)
      Parameters:
      str -
      delimiter -
      max -
      trim -
      Returns:
    • splitPreserveAllTokens

      public static String[] splitPreserveAllTokens(String str, char delimiter)
      Split preserve all tokens.
      Parameters:
      str -
      delimiter -
      Returns:
    • splitPreserveAllTokens

      public static String[] splitPreserveAllTokens(String str, char delimiter, boolean trim)
      Split preserve all tokens.
      Parameters:
      str -
      delimiter -
      trim -
      Returns:
    • splitPreserveAllTokens

      public static String[] splitPreserveAllTokens(String str, String delimiter)
      Split preserve all tokens.
      Parameters:
      str -
      delimiter -
      Returns:
    • splitPreserveAllTokens

      public static String[] splitPreserveAllTokens(String str, String delimiter, boolean trim)
      Split preserve all tokens.
      Parameters:
      str -
      delimiter -
      trim -
      Returns:
    • splitPreserveAllTokens

      public static String[] splitPreserveAllTokens(String str, String delimiter, int max)
      Split preserve all tokens.
      Parameters:
      str -
      delimiter -
      max -
      Returns:
    • splitPreserveAllTokens

      public static String[] splitPreserveAllTokens(String str, String delimiter, int max, boolean trim)
      Split preserve all tokens.
      Parameters:
      str -
      delimiter -
      max -
      trim -
      Returns:
    • trim

      public static String trim(String str)

      Removes control characters (char <= 32) from both ends of this String, handling null by returning null.

      The String is trimmed using String.trim(). Trim removes start and end characters <= 32. To strip whitespace use strip(String).

      To trim your choice of characters, use the strip(String, String) methods.

       Strings.trim(null)          = null
       Strings.trim("")            = ""
       Strings.trim("     ")       = ""
       Strings.trim("abc")         = "abc"
       Strings.trim("    abc    ") = "abc"
       
      Parameters:
      str - the String to be trimmed, may be null
      Returns:
    • trim

      public static void trim(String[] strs)
      Parameters:
      strs -
    • trimToNull

      public static String trimToNull(String str)

      Removes control characters (char <= 32) from both ends of this String returning null if the String is empty ("") after the trim or if it is null.

      The String is trimmed using String.trim(). Trim removes start and end characters <= 32. To strip whitespace use stripToNull(String).

       Strings.trimToNull(null)          = null
       Strings.trimToNull("")            = null
       Strings.trimToNull("     ")       = null
       Strings.trimToNull("abc")         = "abc"
       Strings.trimToNull("    abc    ") = "abc"
       
      Parameters:
      str - the String to be trimmed, may be null
      Returns:
      null String input
      Since:
      2.0
    • trimToNull

      public static void trimToNull(String[] strs)
      Parameters:
      strs -
    • trimToEmpty

      public static String trimToEmpty(String str)

      Removes control characters (char <= 32) from both ends of this String returning an empty String ("") if the String is empty ("") after the trim or if it is null.

      The String is trimmed using String.trim(). Trim removes start and end characters <= 32. To strip whitespace use stripToEmpty(String).

       Strings.trimToEmpty(null)          = ""
       Strings.trimToEmpty("")            = ""
       Strings.trimToEmpty("     ")       = ""
       Strings.trimToEmpty("abc")         = "abc"
       Strings.trimToEmpty("    abc    ") = "abc"
       
      Parameters:
      str - the String to be trimmed, may be null
      Returns:
      Since:
      2.0
    • trimToEmpty

      public static void trimToEmpty(String[] strs)
      Parameters:
      strs -
    • strip

      public static String strip(String str)

      Strips whitespace from the start and end of a String.

      This is similar to trim(String) but removes whitespace. Whitespace is defined by Character.isWhitespace(char).

      A null input String returns null.

       Strings.strip(null)     = null
       Strings.strip("")       = ""
       Strings.strip("   ")    = ""
       Strings.strip("abc")    = "abc"
       Strings.strip("  abc")  = "abc"
       Strings.strip("abc  ")  = "abc"
       Strings.strip(" abc ")  = "abc"
       Strings.strip(" ab c ") = "ab c"
       
      Parameters:
      str - the String to remove whitespace from, may be null
      Returns:
    • strip

      public static void strip(String[] strs)
      Parameters:
      strs -
    • stripToNull

      public static String stripToNull(String str)

      Strips whitespace from the start and end of a String returning null if the String is empty ("") after the strip.

      This is similar to trimToNull(String) but removes whitespace. Whitespace is defined by Character.isWhitespace(char).

       Strings.stripToNull(null)     = null
       Strings.stripToNull("")       = null
       Strings.stripToNull("   ")    = null
       Strings.stripToNull("abc")    = "abc"
       Strings.stripToNull("  abc")  = "abc"
       Strings.stripToNull("abc  ")  = "abc"
       Strings.stripToNull(" abc ")  = "abc"
       Strings.stripToNull(" ab c ") = "ab c"
       
      Parameters:
      str - the String to be stripped, may be null
      Returns:
      String input
      Since:
      2.0
    • stripToNull

      public static void stripToNull(String[] strs)
      Parameters:
      strs -
    • stripToEmpty

      public static String stripToEmpty(String str)

      Strips whitespace from the start and end of a String returning an empty String if null input.

      This is similar to trimToEmpty(String) but removes whitespace. Whitespace is defined by Character.isWhitespace(char).

       Strings.stripToEmpty(null)     = ""
       Strings.stripToEmpty("")       = ""
       Strings.stripToEmpty("   ")    = ""
       Strings.stripToEmpty("abc")    = "abc"
       Strings.stripToEmpty("  abc")  = "abc"
       Strings.stripToEmpty("abc  ")  = "abc"
       Strings.stripToEmpty(" abc ")  = "abc"
       Strings.stripToEmpty(" ab c ") = "ab c"
       
      Parameters:
      str - the String to be stripped, may be null
      Returns:
      Since:
      2.0
    • stripToEmpty

      public static void stripToEmpty(String[] strs)
      Parameters:
      strs -
    • strip

      public static String strip(String str, String stripChars)

      Strips any of a set of characters from the start and end of a String. This is similar to String.trim() but allows the characters to be stripped to be controlled.

      A null input String returns null. An empty string ("") input returns the empty string.

      If the stripChars String is null, whitespace is stripped as defined by Character.isWhitespace(char). Alternatively use strip(String).

       Strings.strip(null, *)          = null
       Strings.strip("", *)            = ""
       Strings.strip("abc", null)      = "abc"
       Strings.strip("  abc", null)    = "abc"
       Strings.strip("abc  ", null)    = "abc"
       Strings.strip(" abc ", null)    = "abc"
       Strings.strip("  abcyx", "xyz") = "  abc"
       
      Parameters:
      str - the String to remove characters from, may be null
      stripChars - the characters to remove, null treated as whitespace
      Returns:
      the specified String if it's null or empty.
    • strip

      public static void strip(String[] strs, String stripChars)
      Parameters:
      strs -
      stripChars -
    • stripStart

      public static String stripStart(String str, String stripChars)

      Strips any of a set of characters from the start of a String.

      A null input String returns null. An empty string ("") input returns the empty string.

      If the stripChars String is null, whitespace is stripped as defined by Character.isWhitespace(char).

       Strings.stripStart(null, *)          = null
       Strings.stripStart("", *)            = ""
       Strings.stripStart("abc", "")        = "abc"
       Strings.stripStart("abc", null)      = "abc"
       Strings.stripStart("  abc", null)    = "abc"
       Strings.stripStart("abc  ", null)    = "abc  "
       Strings.stripStart(" abc ", null)    = "abc "
       Strings.stripStart("yxabc  ", "xyz") = "abc  "
       
      Parameters:
      str - the String to remove characters from, may be null
      stripChars - the characters to remove, null treated as whitespace
      Returns:
      the specified String if it's null or empty.
    • stripStart

      public static void stripStart(String[] strs, String stripChars)
      Parameters:
      strs -
      stripChars -
    • stripEnd

      public static String stripEnd(String str, String stripChars)

      Strips any of a set of characters from the end of a String.

      A null input String returns null. An empty string ("") input returns the empty string.

      If the stripChars String is null, whitespace is stripped as defined by Character.isWhitespace(char).

       Strings.stripEnd(null, *)          = null
       Strings.stripEnd("", *)            = ""
       Strings.stripEnd("abc", "")        = "abc"
       Strings.stripEnd("abc", null)      = "abc"
       Strings.stripEnd("  abc", null)    = "  abc"
       Strings.stripEnd("abc  ", null)    = "abc"
       Strings.stripEnd(" abc ", null)    = " abc"
       Strings.stripEnd("  abcyx", "xyz") = "  abc"
       Strings.stripEnd("120.00", ".0")   = "12"
       
      Parameters:
      str - the String to remove characters from, may be null
      stripChars - the set of characters to remove, null treated as whitespace
      Returns:
      the specified String if it's null or empty.
    • stripEnd

      public static void stripEnd(String[] strs, String stripChars)
      Parameters:
      strs -
      stripChars -
    • stripAccents

      @MayReturnNull public static String stripAccents(String str)

      Removes diacritics (~= accents) from a string. The case will not be altered.

      For instance, 'à' will be replaced by 'a'.

      Note that ligatures will be left as is.

       Strings.stripAccents(null)                = null
       Strings.stripAccents("")                  = ""
       Strings.stripAccents("control")           = "control"
       Strings.stripAccents("éclair")     = "eclair"
       
      Parameters:
      str -
      Returns:
      input text with diacritics removed. null if (str == null). (auto-generated java doc for return)
      Since:
      3.0
    • stripAccents

      public static void stripAccents(String[] strs)
      Parameters:
      strs -
    • chomp

      public static String chomp(String str)

      Removes one newline from end of a String if it's there, otherwise leave it alone. A newline is "\n ", "\r", or "\r\n".

      NOTE: This method changed in 2.0. It now more closely matches Perl chomp.

       Strings.chomp(null)          = null
       Strings.chomp("")            = ""
       Strings.chomp("abc \r")      = "abc "
       Strings.chomp("abc\n")       = "abc"
       Strings.chomp("abc\r\n")     = "abc"
       Strings.chomp("abc\r\n\r\n") = "abc\r\n"
       Strings.chomp("abc\n\r")     = "abc\n"
       Strings.chomp("abc\n\rabc")  = "abc\n\rabc"
       Strings.chomp("\r")          = ""
       Strings.chomp("\n")          = ""
       Strings.chomp("\r\n")        = ""
       
      Parameters:
      str - the String to chomp a newline from, may be null
      Returns:
      String without newline, null if null String input
    • chomp

      public static void chomp(String[] strs)
      Parameters:
      strs -
    • chop

      public static String chop(String str)

      Remove the last character from a String.

      If the String ends in \r\n, then remove both of them.

       Strings.chop(null)          = null
       Strings.chop("")            = ""
       Strings.chop("abc \r")      = "abc "
       Strings.chop("abc\n")       = "abc"
       Strings.chop("abc\r\n")     = "abc"
       Strings.chop("abc")         = "ab"
       Strings.chop("abc\nabc")    = "abc\nab"
       Strings.chop("a")           = ""
       Strings.chop("\r")          = ""
       Strings.chop("\n")          = ""
       Strings.chop("\r\n")        = ""
       
      Parameters:
      str - the String to chop last character from, may be null
      Returns:
      String without last character, null if null String input
    • chop

      public static void chop(String[] strs)
      Parameters:
      strs -
    • truncate

      public static String truncate(String str, int maxWidth)

      Truncates a String. This will turn "Now is the time for all good men" into "Now is the time for".

      Specifically:

      • If str is less than maxWidth characters long, return it.
      • Else truncate it to substring(str, 0, maxWidth).
      • If maxWidth is less than 0, throw an IllegalArgumentException.
      • In no case will it return a String of length greater than maxWidth.
       Strings.truncate(null, 0)       = null
       Strings.truncate(null, 2)       = null
       Strings.truncate("", 4)         = ""
       Strings.truncate("abcdefg", 4)  = "abcd"
       Strings.truncate("abcdefg", 6)  = "abcdef"
       Strings.truncate("abcdefg", 7)  = "abcdefg"
       Strings.truncate("abcdefg", 8)  = "abcdefg"
       Strings.truncate("abcdefg", -1) = throws an IllegalArgumentException
       
      Parameters:
      str - the String to truncate, may be null
      maxWidth - maximum length of result String, must be positive
      Returns:
      truncated String, null if null String input
      Throws:
      IllegalArgumentException - If maxWidth is less than 0
      Since:
      3.5
    • truncate

      @MayReturnNull public static String truncate(String str, int offset, int maxWidth)

      Truncates a String. This will turn "Now is the time for all good men" into "is the time for all".

      Works like truncate(String, int), but allows you to specify a "left edge" offset.

      Specifically:

      • If str is less than maxWidth characters long, return it.
      • Else truncate it to substring(str, offset, maxWidth).
      • If maxWidth is less than 0, throw an IllegalArgumentException.
      • If offset is less than 0, throw an IllegalArgumentException.
      • In no case will it return a String of length greater than maxWidth.
       Strings.truncate(null, 0, 0) = null
       Strings.truncate(null, 2, 4) = null
       Strings.truncate("", 0, 10) = ""
       Strings.truncate("", 2, 10) = ""
       Strings.truncate("abcdefghij", 0, 3) = "abc"
       Strings.truncate("abcdefghij", 5, 6) = "fghij"
       Strings.truncate("raspberry peach", 10, 15) = "peach"
       Strings.truncate("abcdefghijklmno", 0, 10) = "abcdefghij"
       Strings.truncate("abcdefghijklmno", -1, 10) = throws an IllegalArgumentException
       Strings.truncate("abcdefghijklmno", Integer.MIN_VALUE, 10) = throws an IllegalArgumentException
       Strings.truncate("abcdefghijklmno", Integer.MIN_VALUE, Integer.MAX_VALUE) = throws an IllegalArgumentException
       Strings.truncate("abcdefghijklmno", 0, Integer.MAX_VALUE) = "abcdefghijklmno"
       Strings.truncate("abcdefghijklmno", 1, 10) = "bcdefghijk"
       Strings.truncate("abcdefghijklmno", 2, 10) = "cdefghijkl"
       Strings.truncate("abcdefghijklmno", 3, 10) = "defghijklm"
       Strings.truncate("abcdefghijklmno", 4, 10) = "efghijklmn"
       Strings.truncate("abcdefghijklmno", 5, 10) = "fghijklmno"
       Strings.truncate("abcdefghijklmno", 5, 5) = "fghij"
       Strings.truncate("abcdefghijklmno", 5, 3) = "fgh"
       Strings.truncate("abcdefghijklmno", 10, 3) = "klm"
       Strings.truncate("abcdefghijklmno", 10, Integer.MAX_VALUE) = "klmno"
       Strings.truncate("abcdefghijklmno", 13, 1) = "n"
       Strings.truncate("abcdefghijklmno", 13, Integer.MAX_VALUE) = "no"
       Strings.truncate("abcdefghijklmno", 14, 1) = "o"
       Strings.truncate("abcdefghijklmno", 14, Integer.MAX_VALUE) = "o"
       Strings.truncate("abcdefghijklmno", 15, 1) = ""
       Strings.truncate("abcdefghijklmno", 15, Integer.MAX_VALUE) = ""
       Strings.truncate("abcdefghijklmno", Integer.MAX_VALUE, Integer.MAX_VALUE) = ""
       Strings.truncate("abcdefghij", 3, -1) = throws an IllegalArgumentException
       Strings.truncate("abcdefghij", -2, 4) = throws an IllegalArgumentException
       
      Parameters:
      str - the String to truncate, may be null
      offset - left edge of source String
      maxWidth - maximum length of result String, must be positive
      Returns:
      truncated String, null if null String input
      Throws:
      IllegalArgumentException - If offset or maxWidth is less than 0
      Since:
      3.5
    • deleteWhitespace

      public static String deleteWhitespace(String str)

      Deletes all white spaces from a String as defined by Character.isWhitespace(char).

       Strings.deleteWhitespace(null)         = null
       Strings.deleteWhitespace("")           = ""
       Strings.deleteWhitespace("abc")        = "abc"
       Strings.deleteWhitespace("   ab  c  ") = "abc"
       
      Parameters:
      str - the String to delete whitespace from, may be null
      Returns:
      the specified String if it's null or empty.
    • deleteWhitespace

      public static void deleteWhitespace(String[] strs)
      Parameters:
      strs -
    • appendIfMissing

      public static String appendIfMissing(String str, String suffix)
      Append if missing.
      Parameters:
      str -
      suffix -
      Returns:
    • appendIfMissingIgnoreCase

      public static String appendIfMissingIgnoreCase(String str, String suffix)
      Parameters:
      str -
      suffix -
      Returns:
    • prependIfMissing

      public static String prependIfMissing(String str, String prefix)
      Prepend if missing.
      Parameters:
      str -
      prefix -
      Returns:
    • prependIfMissingIgnoreCase

      public static String prependIfMissingIgnoreCase(String str, String prefix)
      Parameters:
      str -
      prefix -
      Returns:
    • wrapIfMissing

      public static String wrapIfMissing(String str, String prefixSuffix)
      Wrap if missing.
      Parameters:
      str -
      prefixSuffix -
      Returns:
    • wrapIfMissing

      public static String wrapIfMissing(String str, String prefix, String suffix)
       Strings.wrapIfMissing(null, "[", "]") -> "[]"
       Strings.wrapIfMissing("", "[", "]") -> "[]"
       Strings.wrapIfMissing("[", "[", "]") -> "[]"
       Strings.wrapIfMissing("]", "[", "]") -> "[]"
       Strings.wrapIfMissing("abc", "[", "]") -> "[abc]"
       Strings.wrapIfMissing("a", "aa", "aa") -> "aaaaa"
       Strings.wrapIfMissing("aa", "aa", "aa") -> "aaaa"
       Strings.wrapIfMissing("aaa", "aa", "aa") -> "aaaaa"
       Strings.wrapIfMissing("aaaa", "aa", "aa") -> "aaaa"
       
      Parameters:
      str -
      prefix -
      suffix -
      Returns:
    • wrap

      public static String wrap(String str, String prefixSuffix)
      Parameters:
      str -
      prefixSuffix -
      Returns:
    • wrap

      public static String wrap(String str, String prefix, String suffix)
       Strings.wrap(null, "[", "]") -> "[]"
       Strings.wrap("", "[", "]") -> "[]"
       Strings.wrap("[", "[", "]") -> "[[]"
       Strings.wrap("]", "[", "]") -> "[]]"
       Strings.wrap("abc", "[", "]") -> "[abc]"
       Strings.wrap("a", "aa", "aa") -> "aaaaa"
       Strings.wrap("aa", "aa", "aa") -> "aaaaaa"
       Strings.wrap("aaa", "aa", "aa") -> "aaaaaaa"
       
      Parameters:
      str -
      prefix -
      suffix -
      Returns:
    • unwrap

      public static String unwrap(String str, String prefixSuffix)
      Parameters:
      str -
      prefixSuffix -
      Returns:
    • unwrap

      public static String unwrap(String str, String prefix, String suffix)

      Unwraps the specified string str if and only if it's wrapped by the specified prefix and suffix

       Strings.unwrap(null, "[", "]") -> ""
       Strings.unwrap("", "[", "]") -> ""
       Strings.unwrap("[", "[", "]") -> "["
       Strings.unwrap("]", "[", "]") -> "["
       Strings.unwrap("[abc]", "[", "]") -> "abc"
       Strings.unwrap("aaaaa", "aa", "aa") -> "a"
       Strings.unwrap("aa", "aa", "aa") -> "aa"
       Strings.unwrap("aaa", "aa", "aa") -> "aaa"
       Strings.unwrap("aaaa", "aa", "aa") -> ""
       
      Parameters:
      str -
      prefix -
      suffix -
      Returns:
      the specified String if it's null or empty.
    • isLowerCase

      public static boolean isLowerCase(char ch)
      Checks if is lower case.
      Parameters:
      ch -
      Returns:
      true if is lower case
    • isAsciiLowerCase

      public static boolean isAsciiLowerCase(char ch)
      Checks if is ascii lower case.
      Parameters:
      ch -
      Returns:
      true if is ascii lower case
    • isUpperCase

      public static boolean isUpperCase(char ch)
      Checks if is upper case.
      Parameters:
      ch -
      Returns:
      true if is upper case
    • isAsciiUpperCase

      public static boolean isAsciiUpperCase(char ch)
      Checks if is ascii upper case.
      Parameters:
      ch -
      Returns:
      true if is ascii upper case
    • isAllLowerCase

      public static boolean isAllLowerCase(CharSequence cs)
      Checks if is all lower case.
      Parameters:
      cs -
      Returns:
      true if is all lower case
    • isAllUpperCase

      public static boolean isAllUpperCase(CharSequence cs)
      Checks if is all upper case.
      Parameters:
      cs -
      Returns:
      true if is all upper case
    • isMixedCase

      public static boolean isMixedCase(CharSequence cs)
      Copied from Apache Commons Lang: StringUtils#isMixedCase.
      Parameters:
      cs -
      Returns:
      true if is mixed case
    • isDigit

      public static boolean isDigit(char ch)
      Checks if is digit.
      Parameters:
      ch -
      Returns:
      true if is digit
      See Also:
    • isLetter

      public static boolean isLetter(char ch)
      Checks if is letter.
      Parameters:
      ch -
      Returns:
      true if is letter
      See Also:
    • isLetterOrDigit

      public static boolean isLetterOrDigit(char ch)
      Checks if is letter or digit.
      Parameters:
      ch -
      Returns:
      true if is letter or digit
      See Also:
    • isAscii

      public static boolean isAscii(char ch)

      Checks whether the character is ASCII 7 bit.

         Strings.isAscii('a')  = true
         Strings.isAscii('A')  = true
         Strings.isAscii('3')  = true
         Strings.isAscii('-')  = true
         Strings.isAscii('\n') = true
         Strings.isAscii('©') = false
       
      Parameters:
      ch - the character to check
      Returns:
      true if less than 128
    • isAsciiPrintable

      public static boolean isAsciiPrintable(char ch)

      Checks whether the character is ASCII 7 bit printable.

         Strings.isAsciiPrintable('a')  = true
         Strings.isAsciiPrintable('A')  = true
         Strings.isAsciiPrintable('3')  = true
         Strings.isAsciiPrintable('-')  = true
         Strings.isAsciiPrintable('\n') = false
         Strings.isAsciiPrintable('©') = false
       
      Parameters:
      ch - the character to check
      Returns:
      true if between 32 and 126 inclusive
    • isAsciiControl

      public static boolean isAsciiControl(char ch)

      Checks whether the character is ASCII 7 bit control.

         Strings.isAsciiControl('a')  = false
         Strings.isAsciiControl('A')  = false
         Strings.isAsciiControl('3')  = false
         Strings.isAsciiControl('-')  = false
         Strings.isAsciiControl('\n') = true
         Strings.isAsciiControl('©') = false
       
      Parameters:
      ch - the character to check
      Returns:
      true if less than 32 or equals 127
    • isAsciiAlpha

      public static boolean isAsciiAlpha(char ch)

      Checks whether the character is ASCII 7 bit alphabetic.

         Strings.isAsciiAlpha('a')  = true
         Strings.isAsciiAlpha('A')  = true
         Strings.isAsciiAlpha('3')  = false
         Strings.isAsciiAlpha('-')  = false
         Strings.isAsciiAlpha('\n') = false
         Strings.isAsciiAlpha('©') = false
       
      Parameters:
      ch - the character to check
      Returns:
      true if between 65 and 90 or 97 and 122 inclusive
    • isAsciiAlphaUpper

      public static boolean isAsciiAlphaUpper(char ch)

      Checks whether the character is ASCII 7 bit alphabetic upper case.

         Strings.isAsciiAlphaUpper('a')  = false
         Strings.isAsciiAlphaUpper('A')  = true
         Strings.isAsciiAlphaUpper('3')  = false
         Strings.isAsciiAlphaUpper('-')  = false
         Strings.isAsciiAlphaUpper('\n') = false
         Strings.isAsciiAlphaUpper('©') = false
       
      Parameters:
      ch - the character to check
      Returns:
      true if between 65 and 90 inclusive
    • isAsciiAlphaLower

      public static boolean isAsciiAlphaLower(char ch)

      Checks whether the character is ASCII 7 bit alphabetic lower case.

         Strings.isAsciiAlphaLower('a')  = true
         Strings.isAsciiAlphaLower('A')  = false
         Strings.isAsciiAlphaLower('3')  = false
         Strings.isAsciiAlphaLower('-')  = false
         Strings.isAsciiAlphaLower('\n') = false
         Strings.isAsciiAlphaLower('©') = false
       
      Parameters:
      ch - the character to check
      Returns:
      true if between 97 and 122 inclusive
    • isAsciiNumeric

      public static boolean isAsciiNumeric(char ch)

      Checks whether the character is ASCII 7 bit numeric.

         Strings.isAsciiNumeric('a')  = false
         Strings.isAsciiNumeric('A')  = false
         Strings.isAsciiNumeric('3')  = true
         Strings.isAsciiNumeric('-')  = false
         Strings.isAsciiNumeric('\n') = false
         Strings.isAsciiNumeric('©') = false
       
      Parameters:
      ch - the character to check
      Returns:
      true if between 48 and 57 inclusive
    • isAsciiAlphanumeric

      public static boolean isAsciiAlphanumeric(char ch)

      Checks whether the character is ASCII 7 bit numeric.

         Strings.isAsciiAlphanumeric('a')  = true
         Strings.isAsciiAlphanumeric('A')  = true
         Strings.isAsciiAlphanumeric('3')  = true
         Strings.isAsciiAlphanumeric('-')  = false
         Strings.isAsciiAlphanumeric('\n') = false
         Strings.isAsciiAlphanumeric('©') = false
       
      Parameters:
      ch - the character to check
      Returns:
      true if between 48 and 57 or 65 and 90 or 97 and 122 inclusive
    • isAsciiPrintable

      public static boolean isAsciiPrintable(CharSequence cs)
      Checks if the CharSequence contains only ASCII printable characters.

      null will return false. An empty CharSequence (length()=0) will return true.

       Strings.isAsciiPrintable(null)     = false
       Strings.isAsciiPrintable("")       = true
       Strings.isAsciiPrintable(" ")      = true
       Strings.isAsciiPrintable("Ceki")   = true
       Strings.isAsciiPrintable("ab2c")   = true
       Strings.isAsciiPrintable("!ab-c~") = true
       Strings.isAsciiPrintable(" ") = true
       Strings.isAsciiPrintable("!") = true
       Strings.isAsciiPrintable("~") = true
       Strings.isAsciiPrintable("") = false
       Strings.isAsciiPrintable("Ceki Gülcü") = false
       
      Parameters:
      cs -
      Returns:
      true if is ascii printable. false is returned if the specified CharSequence is null.
    • isAsciiAlpha

      public static boolean isAsciiAlpha(CharSequence cs)
      Checks if is ascii alpha.
      Parameters:
      cs -
      Returns:
      true if is ascii alpha, and is non-null. false is returned if the specified CharSequence is null or empty.
    • isAsciiAlphaSpace

      public static boolean isAsciiAlphaSpace(CharSequence cs)
      Checks if is ascii alpha space.
      Parameters:
      cs -
      Returns:
      true if is ascii alpha space, and is non-null. false is returned if the specified CharSequence is null.
    • isAsciiAlphanumeric

      public static boolean isAsciiAlphanumeric(CharSequence cs)
      Checks if is ascii alphanumeric.
      Parameters:
      cs -
      Returns:
      true if is ascii alphanumeric, and is non-null. false is returned if the specified CharSequence is null or empty.
    • isAsciiAlphanumericSpace

      public static boolean isAsciiAlphanumericSpace(CharSequence cs)
      Checks if is ascii alphanumeric space.
      Parameters:
      cs -
      Returns:
      true if is ascii alphanumeric space, and is non-null. false is returned if the specified CharSequence is null.
    • isAsciiNumeric

      public static boolean isAsciiNumeric(CharSequence cs)
      Checks if is ascii numeric.
      Parameters:
      cs -
      Returns:
      true if is ascii numeric, and is non-null. false is returned if the specified CharSequence is null or empty.
    • isAlpha

      public static boolean isAlpha(CharSequence cs)

      Checks if the CharSequence contains only Unicode letters.

      null or empty CharSequence (length()=0) will return false .

       Strings.isAlpha(null)   = false
       Strings.isAlpha("")     = false
       Strings.isAlpha("  ")   = false
       Strings.isAlpha("abc")  = true
       Strings.isAlpha("ab2c") = false
       Strings.isAlpha("ab-c") = false
       
      Parameters:
      cs - the CharSequence to check, may be null
      Returns:
      true if only contains letters, and is non-null. false is returned if the specified CharSequence is null or empty.
      Since:
      3.0 Changed signature from isAlpha(String) to isAlpha(CharSequence), 3.0 Changed "" to return false and not true
    • isAlphaSpace

      public static boolean isAlphaSpace(CharSequence cs)

      Checks if the CharSequence contains only Unicode letters and space (' ').

      null or empty CharSequence (length()=0) will return false .

       Strings.isAlphaSpace(null)   = false
       Strings.isAlphaSpace("")     = true
       Strings.isAlphaSpace("  ")   = true
       Strings.isAlphaSpace("abc")  = true
       Strings.isAlphaSpace("ab c") = true
       Strings.isAlphaSpace("ab2c") = false
       Strings.isAlphaSpace("ab-c") = false
       
      Parameters:
      cs - the CharSequence to check, may be null
      Returns:
      true if only contains letters and space, and is non-null. false is returned if the specified CharSequence is null.
      Since:
      3.0 Changed signature from isAlphaSpace(String) to isAlphaSpace(CharSequence)
    • isAlphanumeric

      public static boolean isAlphanumeric(CharSequence cs)

      Checks if the CharSequence contains only Unicode letters or digits.

      null or empty CharSequence (length()=0) will return false .

       Strings.isAlphanumeric(null)   = false
       Strings.isAlphanumeric("")     = false
       Strings.isAlphanumeric("  ")   = false
       Strings.isAlphanumeric("abc")  = true
       Strings.isAlphanumeric("ab c") = false
       Strings.isAlphanumeric("ab2c") = true
       Strings.isAlphanumeric("ab-c") = false
       
      Parameters:
      cs - the CharSequence to check, may be null
      Returns:
      true if only contains letters or digits, and is non-null. false is returned if the specified CharSequence is null or empty.
      Since:
      3.0 Changed signature from isAlphanumeric(String) to isAlphanumeric(CharSequence), 3.0 Changed "" to return false and not true
    • isAlphanumericSpace

      public static boolean isAlphanumericSpace(CharSequence cs)

      Checks if the CharSequence contains only Unicode letters, digits or space (' ').

      null or empty CharSequence (length()=0) will return false .

       Strings.isAlphanumericSpace(null)   = false
       Strings.isAlphanumericSpace("")     = true
       Strings.isAlphanumericSpace("  ")   = true
       Strings.isAlphanumericSpace("abc")  = true
       Strings.isAlphanumericSpace("ab c") = true
       Strings.isAlphanumericSpace("ab2c") = true
       Strings.isAlphanumericSpace("ab-c") = false
       
      Parameters:
      cs - the CharSequence to check, may be null
      Returns:
      true if only contains letters, digits or space, and is non-null. false is returned if the specified CharSequence is null.
      Since:
      3.0 Changed signature from isAlphanumericSpace(String) to isAlphanumericSpace(CharSequence)
    • isNumeric

      public static boolean isNumeric(CharSequence cs)

      Checks if the CharSequence contains only Unicode digits. A decimal point is not a Unicode digit and returns false.

      null will return false. An empty CharSequence (length()=0) will return false.

      Note that the method does not allow for a leading sign, either positive or negative. Also, if a String passes the numeric test, it may still generate a NumberFormatException when parsed by Integer.parseInt or Long.parseLong, e.g. if the value is outside the range for int or long respectively.

       Strings.isNumeric(null)   = false
       Strings.isNumeric("")     = false
       Strings.isNumeric("  ")   = false
       Strings.isNumeric("123")  = true
       Strings.isNumeric("12 3") = false
       Strings.isNumeric("ab2c") = false
       Strings.isNumeric("12-3") = false
       Strings.isNumeric("12.3") = false
       Strings.isNumeric("-123") = false
       Strings.isNumeric("+123") = false
       
      Parameters:
      cs - the CharSequence to check, may be null
      Returns:
      true if only contains digits, and is non-null. false is returned if the specified CharSequence is null or empty.
      Since:
      3.0 Changed signature from isNumeric(String) to isNumeric(CharSequence), 3.0 Changed "" to return false and not true
    • isNumericSpace

      public static boolean isNumericSpace(CharSequence cs)
      Checks if the CharSequence contains only Unicode digits or space (' '). A decimal point is not a Unicode digit and returns false.

      null will return false. An empty CharSequence (length()=0) will return true.

       Strings.isNumericSpace(null)   = false
       Strings.isNumericSpace("")     = true
       Strings.isNumericSpace("  ")   = true
       Strings.isNumericSpace("123")  = true
       Strings.isNumericSpace("12 3") = true
       Strings.isNumericSpace("१२३")  = true
       Strings.isNumericSpace("१२ ३")  = true
       Strings.isNumericSpace("ab2c") = false
       Strings.isNumericSpace("12-3") = false
       Strings.isNumericSpace("12.3") = false
       
      Parameters:
      cs - the CharSequence to check, may be null
      Returns:
      true if only contains digits or space, and is non-null. false is returned if the specified CharSequence is null.
      Since:
      3.0 Changed signature from isNumericSpace(String) to isNumericSpace(CharSequence)
    • isWhitespace

      public static boolean isWhitespace(CharSequence cs)
      Checks if the CharSequence contains only whitespace.

      Whitespace is defined by Character.isWhitespace(char).

      null will return false. An empty CharSequence (length()=0) will return true.

       Strings.isWhitespace(null)   = false
       Strings.isWhitespace("")     = true
       Strings.isWhitespace("  ")   = true
       Strings.isWhitespace("abc")  = false
       Strings.isWhitespace("ab2c") = false
       Strings.isWhitespace("ab-c") = false
       
      Parameters:
      cs - the CharSequence to check, may be null
      Returns:
      true if only contains whitespace, and is non-null. false is returned if the specified CharSequence is null.
      Since:
      2.0, 3.0 Changed signature from isWhitespace(String) to isWhitespace(CharSequence)
    • isNumber

      @Deprecated public static boolean isNumber(String str)
      Deprecated.
      Note: It's copied from NumberUtils in Apache Commons Lang under Apache License 2.0

      Checks whether the String a valid Java number. true is returned if there is a number which can be initialized by createNumber with specified String.

      Null and empty String will return false.

      Parameters:
      str - the String to check
      Returns:
      true if the string is a correctly formatted number
      Since:
      3.3 the code supports hex 0Xhhh and octal 0ddd validation
      See Also:
    • isAsciiDigtalNumber

      public static boolean isAsciiDigtalNumber(String str)
      true is returned if the specified str only includes characters ('0' ~ '9', '.', '-', '+', 'e'). false is return if the specified String is null/empty, or contains empty chars. "0" => true " 0.1 " => false "abc" => false "1 a" => false "2e10" => true "2E-10" => true
      Parameters:
      str -
      Returns:
      true if is ascii digtal number
    • isAsciiDigtalInteger

      public static boolean isAsciiDigtalInteger(String str)
      true is returned if the specified str only includes characters ('0' ~ '9', '-', '+' ). false is return if the specified String is null/empty, or contains empty chars. "-123" => true "+123" => true "123" => true "+0" => true "-0" => true "0" => true " 0.1 " => false "abc" => false "1 a" => false "2e10" => false
      Parameters:
      str -
      Returns:
      true if is ascii digtal integer
    • indexOf

      public static int indexOf(String str, int targetChar)
      Parameters:
      str -
      targetChar -
      Returns:
    • indexOf

      public static int indexOf(String str, int fromIndex, char targetChar)
      Parameters:
      str -
      fromIndex -
      targetChar -
      Returns:
    • indexOf

      public static int indexOf(String str, String substr)
      Parameters:
      str -
      substr -
      Returns:
    • indexOf

      public static int indexOf(String str, int fromIndex, String substr)
      Parameters:
      str -
      fromIndex -
      substr -
      Returns:
    • indexOfAny

      @SafeVarargs public static int indexOfAny(String str, char... chs)
      Parameters:
      str -
      chs -
      Returns:
    • indexOfAny

      @SafeVarargs public static int indexOfAny(String str, int fromIndex, char... chs)
      Parameters:
      str -
      fromIndex -
      chs -
      Returns:
    • indexOfAny

      @SafeVarargs public static int indexOfAny(String str, String... substrs)
      Parameters:
      str -
      substrs -
      Returns:
      See Also:
    • indexOfAny

      @SafeVarargs public static int indexOfAny(String str, int fromIndex, String... substrs)
      Parameters:
      str -
      fromIndex -
      substrs -
      Returns:
      See Also:
    • indexOfAnyBut

      @SafeVarargs public static int indexOfAnyBut(String str, char... chs)
      Index of any but.
      Parameters:
      str -
      chs -
      Returns:
    • indexOfAnyBut

      @SafeVarargs public static int indexOfAnyBut(String str, int fromIndex, char... chs)
      Parameters:
      str -
      fromIndex -
      chs -
      Returns:
    • indexOf

      public static int indexOf(String str, String substr, String delimiter)
      Parameters:
      str -
      substr -
      delimiter -
      Returns:
    • indexOf

      public static int indexOf(String str, int fromIndex, String substr, String delimiter)
      Parameters:
      str -
      fromIndex - the index from which to start the search.
      substr -
      delimiter -
      Returns:
    • indexOfIgnoreCase

      public static int indexOfIgnoreCase(String str, String substr)
      Index of ignore case.
      Parameters:
      str -
      substr -
      Returns:
    • indexOfIgnoreCase

      public static int indexOfIgnoreCase(String str, int fromIndex, String substr)
      Index of ignore case.
      Parameters:
      str -
      fromIndex -
      substr -
      Returns:
    • lastIndexOf

      public static int lastIndexOf(String str, int targetChar)
      Last index of.
      Parameters:
      str -
      targetChar -
      Returns:
    • lastIndexOf

      public static int lastIndexOf(String str, int fromIndex, char targetChar)
      Returns the index within this string of the last occurrence of the specified character, searching backward starting at the specified index. For values of ch in the range from 0 to 0xFFFF (inclusive), the index returned is the largest value k such that:
       (this.charAt(k) == ch) && (k <= fromIndex)
       
      is true. For other values of ch, it is the largest value k such that:
       (this.codePointAt(k) == ch) && (k <= fromIndex)
       
      is true. In either case, if no such character occurs in this string at or before position fromIndex, then -1 is returned.

      All indices are specified in char values (Unicode code units).

      Parameters:
      str -
      fromIndex - the index to start the search from. There is no restriction on the value of fromIndex. If it is greater than or equal to the length of this string, it has the same effect as if it were equal to one less than the length of this string: this entire string may be searched. If it is negative, it has the same effect as if it were -1: -1 is returned.
      targetChar - a character (Unicode code point).
      Returns:
      character sequence represented by this object that is less than or equal to fromIndex, or -1 if the character does not occur before that point.
    • lastIndexOf

      public static int lastIndexOf(String str, String substr)
      Last index of.
      Parameters:
      str -
      substr -
      Returns:
    • lastIndexOf

      public static int lastIndexOf(String str, int fromIndex, String substr)
      Returns the index within str of the last occurrence of the specified substr, searching backward starting at the specified index.

      The returned index is the largest value k for which:

       k <= fromIndex && str.startsWith(substr, k)
       
      If no such value of k exists, then -1 is returned.
      Parameters:
      str -
      fromIndex -
      substr -
      Returns:
    • lastIndexOf

      public static int lastIndexOf(String str, String substr, String delimiter)
      Last index of.
      Parameters:
      str -
      substr -
      delimiter -
      Returns:
    • lastIndexOf

      public static int lastIndexOf(String str, int fromIndex, String substr, String delimiter)
      Last index of.
      Parameters:
      str -
      fromIndex - the start index to traverse backwards from
      substr -
      delimiter -
      Returns:
    • lastIndexOfIgnoreCase

      public static int lastIndexOfIgnoreCase(String str, String substr)
      Last index of ignore case.
      Parameters:
      str -
      substr -
      Returns:
    • lastIndexOfIgnoreCase

      public static int lastIndexOfIgnoreCase(String str, int fromIndex, String substr)
      Last index of ignore case.
      Parameters:
      str -
      fromIndex -
      substr -
      Returns:
    • lastIndexOfAny

      @SafeVarargs public static int lastIndexOfAny(String str, char... chs)
      Last index of any.
      Parameters:
      str -
      chs -
      Returns:
    • lastIndexOfAny

      @SafeVarargs public static int lastIndexOfAny(String str, String... substrs)
      Last index of any.
      Parameters:
      str -
      substrs -
      Returns:
      See Also:
    • smallestindicesOfAll

      @SafeVarargs public static int smallestindicesOfAll(String str, String... substrs)

      Find the smallest index of any of a set of potential substrings.

      Parameters:
      str -
      substrs -
      Returns:
      See Also:
    • smallestindicesOfAll

      @SafeVarargs public static int smallestindicesOfAll(String str, int fromIndex, String... substrs)

      Find the smallest index of any of a set of potential substrings from fromIndex.

      Parameters:
      str -
      fromIndex -
      substrs -
      Returns:
      See Also:
    • largestindicesOfAll

      @SafeVarargs public static int largestindicesOfAll(String str, String... substrs)

      Find the largest index of any of a set of potential substrings.

      Parameters:
      str -
      substrs -
      Returns:
      See Also:
    • largestindicesOfAll

      @SafeVarargs public static int largestindicesOfAll(String str, int fromIndex, String... substrs)

      Find the largest index of any of a set of potential substrings.

      Parameters:
      str -
      fromIndex -
      substrs -
      Returns:
      See Also:
    • smallestLastindicesOfAll

      @SafeVarargs public static int smallestLastindicesOfAll(String str, String... substrs)

      Find the smallest last index of any of a set of potential substrings from fromIndex.

      Parameters:
      str -
      substrs -
      Returns:
      See Also:
    • smallestLastindicesOfAll

      @SafeVarargs public static int smallestLastindicesOfAll(String str, int fromIndex, String... substrs)

      Find the smallest last index of any of a set of potential substrings from fromIndex.

      Parameters:
      str -
      fromIndex -
      substrs -
      Returns:
      See Also:
    • largestLastindicesOfAll

      @SafeVarargs public static int largestLastindicesOfAll(String str, String... substrs)

      Find the largest index among the first index of any of a set of potential substrings.

      Parameters:
      str -
      substrs -
      Returns:
      See Also:
    • largestLastindicesOfAll

      @SafeVarargs public static int largestLastindicesOfAll(String str, int fromIndex, String... substrs)

      Find the largest index among the first index of any of a set of potential substrings.

      Parameters:
      str -
      fromIndex -
      substrs -
      Returns:
      See Also:
    • ordinalIndexOf

      public static int ordinalIndexOf(String str, String substr, int ordinal)

      Finds the n-th index within a String, handling null.

      Parameters:
      str -
      substr -
      ordinal - the n-th searchStr to find
      Returns:
      N.INDEX_NOT_FOUND) if no match or null or empty string input
    • lastOrdinalIndexOf

      public static int lastOrdinalIndexOf(String str, String substr, int ordinal)

      Finds the n-th last index within a String, handling null.

      Parameters:
      str -
      substr -
      ordinal - the n-th last searchStr to find
      Returns:
      N.INDEX_NOT_FOUND) if no match or null or empty string input
    • countMatches

      public static int countMatches(String str, char ch)
      Parameters:
      str -
      ch -
      Returns:
      See Also:
    • countMatches

      public static int countMatches(String str, String substr)
      Parameters:
      str -
      substr -
      Returns:
      See Also:
    • contains

      public static boolean contains(String str, int targetChar)
      Parameters:
      str -
      targetChar -
      Returns:
    • contains

      public static boolean contains(String str, String substr)
      Parameters:
      str -
      substr -
      Returns:
    • contains

      public static boolean contains(String str, String substr, String delimiter)
      Parameters:
      str -
      substr -
      delimiter -
      Returns:
    • containsIgnoreCase

      public static boolean containsIgnoreCase(String str, String substr)
      Contains ignore case.
      Parameters:
      str -
      substr -
      Returns:
    • containsAny

      @SafeVarargs public static boolean containsAny(String str, char... chs)
      Parameters:
      str -
      chs -
      Returns:
    • containsAny

      @SafeVarargs public static boolean containsAny(String str, String... searchStrs)
      Parameters:
      str -
      searchStrs -
      Returns:
    • containsAnyIgnoreCase

      @SafeVarargs public static boolean containsAnyIgnoreCase(String str, String... searchStrs)
      Parameters:
      str -
      searchStrs -
      Returns:
    • containsAll

      @SafeVarargs public static boolean containsAll(String str, char... chs)
      Parameters:
      str -
      chs -
      Returns:
    • containsAll

      @SafeVarargs public static boolean containsAll(String str, String... searchStrs)
      Parameters:
      str -
      searchStrs -
      Returns:
    • containsAllIgnoreCase

      @SafeVarargs public static boolean containsAllIgnoreCase(String str, String... searchStrs)
      Parameters:
      str -
      searchStrs -
      Returns:
    • containsOnly

      @SafeVarargs public static boolean containsOnly(String str, char... chs)
      Parameters:
      str -
      chs -
      Returns:
    • containsNone

      @SafeVarargs public static boolean containsNone(String str, char... chs)
      Parameters:
      str -
      chs -
      Returns:
    • containsWhitespace

      public static boolean containsWhitespace(String str)
      Parameters:
      str -
      Returns:
    • startsWith

      public static boolean startsWith(String str, String prefix)
      Parameters:
      str -
      prefix -
      Returns:
    • startsWithIgnoreCase

      public static boolean startsWithIgnoreCase(String str, String prefix)
      Starts with ignore case.
      Parameters:
      str -
      prefix -
      Returns:
    • startsWithAny

      @SafeVarargs public static boolean startsWithAny(String str, String... substrs)
      Starts with any.
      Parameters:
      str -
      substrs -
      Returns:
    • startsWithAnyIgnoreCase

      @SafeVarargs public static boolean startsWithAnyIgnoreCase(String str, String... substrs)
      Starts with any.
      Parameters:
      str -
      substrs -
      Returns:
    • endsWith

      public static boolean endsWith(String str, String suffix)
      Parameters:
      str -
      suffix -
      Returns:
    • endsWithIgnoreCase

      public static boolean endsWithIgnoreCase(String str, String suffix)
      Ends with ignore case.
      Parameters:
      str -
      suffix -
      Returns:
    • endsWithAny

      @SafeVarargs public static boolean endsWithAny(String str, String... substrs)
      Ends with any.
      Parameters:
      str -
      substrs -
      Returns:
    • endsWithAnyIgnoreCase

      public static boolean endsWithAnyIgnoreCase(String str, String... substrs)
      Ends with ignore case.
      Parameters:
      str -
      substrs -
      Returns:
    • equals

      public static boolean equals(String a, String b)
      Parameters:
      a -
      b -
      Returns:
    • equalsIgnoreCase

      public static boolean equalsIgnoreCase(String a, String b)
      Equals ignore case.
      Parameters:
      a -
      b -
      Returns:
    • equalsAny

      @SafeVarargs public static boolean equalsAny(String str, String... searchStrings)
      Equals with any.
      Parameters:
      str -
      searchStrings -
      Returns:
    • equalsAnyIgnoreCase

      @SafeVarargs public static boolean equalsAnyIgnoreCase(String str, String... searchStrs)
      Equals with any.
      Parameters:
      str -
      searchStrs -
      Returns:
    • compareIgnoreCase

      public static int compareIgnoreCase(String a, String b)
      Compare ignore case.
      Parameters:
      a -
      b -
      Returns:
    • indexOfDifference

      public static int indexOfDifference(String a, String b)

      Compares two Strings, and returns the index at which the Stringss begin to differ.

      For example, indexOfDifference("i am a machine", "i am a robot") -> 7

       Strings.indexOfDifference(null, null) = -1
       Strings.indexOfDifference("", "") = -1
       Strings.indexOfDifference("", "abc") = 0
       Strings.indexOfDifference("abc", "") = 0
       Strings.indexOfDifference("abc", "abc") = -1
       Strings.indexOfDifference("ab", "abxyz") = 2
       Strings.indexOfDifference("abcde", "abxyz") = 2
       Strings.indexOfDifference("abcde", "xyz") = 0
       
      Parameters:
      a - the first String, may be null
      b - the second String, may be null
      Returns:
    • indexOfDifference

      @SafeVarargs public static int indexOfDifference(String... strs)

      Compares all Strings in an array and returns the index at which the Strings begin to differ.

      For example, indexOfDifference(new String[] {"i am a machine", "i am a robot"}) -> 7

       Strings.indexOfDifference(null) = -1
       Strings.indexOfDifference(new String[] {}) = -1
       Strings.indexOfDifference(new String[] {"abc"}) = -1
       Strings.indexOfDifference(new String[] {null, null}) = -1
       Strings.indexOfDifference(new String[] {"", ""}) = -1
       Strings.indexOfDifference(new String[] {"", null}) = -1
       Strings.indexOfDifference(new String[] {"abc", null, null}) = 0
       Strings.indexOfDifference(new String[] {null, null, "abc"}) = 0
       Strings.indexOfDifference(new String[] {"", "abc"}) = 0
       Strings.indexOfDifference(new String[] {"abc", ""}) = 0
       Strings.indexOfDifference(new String[] {"abc", "abc"}) = -1
       Strings.indexOfDifference(new String[] {"abc", "a"}) = 1
       Strings.indexOfDifference(new String[] {"ab", "abxyz"}) = 2
       Strings.indexOfDifference(new String[] {"abcde", "abxyz"}) = 2
       Strings.indexOfDifference(new String[] {"abcde", "xyz"}) = 0
       Strings.indexOfDifference(new String[] {"xyz", "abcde"}) = 0
       Strings.indexOfDifference(new String[] {"i am a machine", "i am a robot"}) = 7
       
      Parameters:
      strs - array of Strings, entries may be null
      Returns:
      equal or null/empty
    • commonPrefix

      public static String commonPrefix(String a, String b)
      Note: copy rights: Google Guava. Returns the longest string prefix such that a.toString().startsWith(prefix) && b.toString().startsWith(prefix) , taking care not to split surrogate pairs. If a and b have no common prefix, returns the empty string.
      Parameters:
      a -
      b -
      Returns:
    • commonPrefix

      @SafeVarargs public static String commonPrefix(String... strs)
      Parameters:
      strs -
      Returns:
    • commonSuffix

      public static String commonSuffix(String a, String b)
      Note: copy rights: Google Guava. Returns the longest string suffix such that a.toString().endsWith(suffix) && b.toString().endsWith(suffix), taking care not to split surrogate pairs. If a and b have no common suffix, returns the empty string.
      Parameters:
      a -
      b -
      Returns:
    • commonSuffix

      @SafeVarargs public static String commonSuffix(String... strs)
      Parameters:
      strs -
      Returns:
    • longestCommonSubstring

      public static String longestCommonSubstring(String a, String b)
      Parameters:
      a -
      b -
      Returns:
      an empty String "" is a or b is empty or null.
    • substring

      @MayReturnNull public static String substring(String str, int inclusiveBeginIndex)
      Returns null if (str == null || inclusiveBeginIndex < 0 || inclusiveBeginIndex > str.length()), otherwise returns: str.substring(inclusiveBeginIndex).
      Parameters:
      str -
      inclusiveBeginIndex -
      Returns:
      null if (str == null || inclusiveBeginIndex < 0 || inclusiveBeginIndex > str.length()). (auto-generated java doc for return)
      See Also:
    • substring

      @MayReturnNull public static String substring(String str, int inclusiveBeginIndex, int exclusiveEndIndex)
      Returns null if str == null || inclusiveBeginIndex < 0 || exclusiveEndIndex < 0 || inclusiveBeginIndex > exclusiveEndIndex || inclusiveBeginIndex > str.length(), otherwise returns: str.substring(inclusiveBeginIndex, min(exclusiveEndIndex, str.length())).
      Parameters:
      str -
      inclusiveBeginIndex -
      exclusiveEndIndex -
      Returns:
      null if (str == null || inclusiveBeginIndex < 0 || exclusiveEndIndex < 0 || inclusiveBeginIndex > exclusiveEndIndex || inclusiveBeginIndex > str.length()). (auto-generated java doc for return)
    • substring

      @MayReturnNull public static String substring(String str, int inclusiveBeginIndex, IntUnaryOperator funcOfExclusiveEndIndex)
      Returns null if (str == null || inclusiveBeginIndex < 0), or funcOfExclusiveEndIndex.applyAsInt(inclusiveBeginIndex) < 0.
      Parameters:
      str -
      inclusiveBeginIndex -
      funcOfExclusiveEndIndex - exclusiveEndIndex <- funcOfExclusiveEndIndex.applyAsInt(inclusiveBeginIndex) if inclusiveBeginIndex >= 0
      Returns:
      null if (str == null || inclusiveBeginIndex < 0). (auto-generated java doc for return)
      See Also:
    • substring

      @MayReturnNull @Beta public static String substring(String str, int inclusiveBeginIndex, BiFunction<String,Integer,Integer> funcOfExclusiveEndIndex)
      Returns null if (str == null || inclusiveBeginIndex < 0), or funcOfExclusiveEndIndex.apply(str, inclusiveBeginIndex) < 0.
      Parameters:
      str -
      inclusiveBeginIndex -
      funcOfExclusiveEndIndex - exclusiveEndIndex <- funcOfExclusiveEndIndex.apply(str, inclusiveBeginIndex) if inclusiveBeginIndex >= 0
      Returns:
      null if (str == null || inclusiveBeginIndex < 0). (auto-generated java doc for return)
      See Also:
    • substring

      @MayReturnNull public static String substring(String str, IntUnaryOperator funcOfInclusiveBeginIndex, int exclusiveEndIndex)
      Returns null if (str == null || exclusiveEndIndex < 0), or funcOfInclusiveBeginIndex.applyAsInt(exclusiveEndIndex) < 0.
      Parameters:
      str -
      funcOfInclusiveBeginIndex - inclusiveBeginIndex <- funcOfInclusiveBeginIndex.applyAsInt(exclusiveEndIndex)) if exclusiveEndIndex > 0
      exclusiveEndIndex -
      Returns:
      null if (str == null || exclusiveEndIndex < 0). (auto-generated java doc for return)
      See Also:
    • substring

      @MayReturnNull @Beta public static String substring(String str, BiFunction<String,Integer,Integer> funcOfInclusiveBeginIndex, int exclusiveEndIndex)
      Returns null if (str == null || exclusiveEndIndex < 0), or funcOfInclusiveBeginIndex.apply(str, exclusiveEndIndex) < 0.
      Parameters:
      str -
      funcOfInclusiveBeginIndex - inclusiveBeginIndex <- funcOfInclusiveBeginIndex.apply(str, exclusiveEndIndex)) if exclusiveEndIndex > 0
      exclusiveEndIndex -
      Returns:
      null if (str == null || exclusiveEndIndex < 0). (auto-generated java doc for return)
      See Also:
    • substring

      @MayReturnNull @Deprecated public static String substring(String str, char delimiterOfInclusiveBeginIndex)
      Deprecated.
      Returns null if (str == null || str.length() == 0), or str.indexOf(delimiterOfInclusiveBeginIndex) < 0, otherwise returns: str.substring(str.indexOf(delimiterOfInclusiveBeginIndex)).
      Parameters:
      str -
      delimiterOfInclusiveBeginIndex - inclusiveBeginIndex <- str.indexOf(delimiterOfInclusiveBeginIndex)
      Returns:
      null if (str == null || str.length() == 0). (auto-generated java doc for return)
      See Also:
    • substring

      @MayReturnNull @Deprecated public static String substring(String str, String delimiterOfInclusiveBeginIndex)
      Deprecated.
      Returns null if (str == null || delimiterOfInclusiveBeginIndex == null), or str.indexOf(delimiterOfInclusiveBeginIndex) < 0, otherwise returns: str.substring(str.indexOf(delimiterOfInclusiveBeginIndex)).
      Parameters:
      str -
      delimiterOfInclusiveBeginIndex - inclusiveBeginIndex <- str.indexOf(delimiterOfInclusiveBeginIndex)
      Returns:
      null if (str == null || delimiterOfInclusiveBeginIndex == null). (auto-generated java doc for return)
      See Also:
    • substring

      @MayReturnNull @Deprecated public static String substring(String str, int inclusiveBeginIndex, char delimiterOfExclusiveEndIndex)
      Deprecated.
      Returns null if (str == null || str.length() == 0 || inclusiveBeginIndex < 0 || inclusiveBeginIndex > str.length()), or str.indexOf(delimiterOfExclusiveEndIndex, inclusiveBeginIndex + 1).
      Parameters:
      str -
      inclusiveBeginIndex -
      delimiterOfExclusiveEndIndex - str.indexOf(delimiterOfExclusiveEndIndex, inclusiveBeginIndex + 1)
      Returns:
      null if (str == null || str.length() == 0 || inclusiveBeginIndex < 0 || inclusiveBeginIndex > str.length()). (auto-generated java doc for return)
      See Also:
    • substring

      @MayReturnNull @Deprecated public static String substring(String str, int inclusiveBeginIndex, String delimiterOfExclusiveEndIndex)
      Deprecated.
      Returns null if (str == null || delimiterOfExclusiveEndIndex == null || inclusiveBeginIndex < 0 || inclusiveBeginIndex > str.length()), or str.indexOf(delimiterOfExclusiveEndIndex, inclusiveBeginIndex + 1) < 0.
      Parameters:
      str -
      inclusiveBeginIndex -
      delimiterOfExclusiveEndIndex - exclusiveEndIndex <- str.indexOf(delimiterOfExclusiveEndIndex, inclusiveBeginIndex + 1) if inclusiveBeginIndex >= 0
      Returns:
      null if (str == null || delimiterOfExclusiveEndIndex == null || inclusiveBeginIndex < 0 || inclusiveBeginIndex > str.length()). (auto-generated java doc for return)
      See Also:
    • substring

      @MayReturnNull @Deprecated public static String substring(String str, char delimiterOfInclusiveBeginIndex, int exclusiveEndIndex)
      Deprecated.
      Returns null if (str == null || str.length() == 0 || exclusiveEndIndex < 0), or str.lastIndexOf(delimiterOfInclusiveBeginIndex, exclusiveEndIndex - 1) < 0.
      Parameters:
      str -
      delimiterOfInclusiveBeginIndex - inclusiveBeginIndex <- str.lastIndexOf(delimiterOfInclusiveBeginIndex, exclusiveEndIndex - 1) if exclusiveEndIndex > 0
      exclusiveEndIndex -
      Returns:
      null if (str == null || str.length() == 0 || exclusiveEndIndex < 0). (auto-generated java doc for return)
      See Also:
    • substring

      @MayReturnNull @Deprecated public static String substring(String str, String delimiterOfInclusiveBeginIndex, int exclusiveEndIndex)
      Deprecated.
      Returns null if (str == null || delimiterOfInclusiveBeginIndex == null || exclusiveEndIndex < 0), or str.lastIndexOf(delimiterOfInclusiveBeginIndex, exclusiveEndIndex - 1) < 0.
      Parameters:
      str -
      delimiterOfInclusiveBeginIndex - inclusiveBeginIndex <- str.lastIndexOf(delimiterOfInclusiveBeginIndex, exclusiveEndIndex - exclusiveEndIndex - delimiterOfInclusiveBeginIndex.length()) if exclusiveEndIndex > 0
      exclusiveEndIndex -
      Returns:
      null if (str == null || delimiterOfInclusiveBeginIndex == null || exclusiveEndIndex < 0). (auto-generated java doc for return)
      See Also:
    • substringAfter

      @MayReturnNull public static String substringAfter(String str, char delimiterOfExclusiveBeginIndex)
      Returns the substring after first delimiterOfExclusiveBeginIndex if it exists, otherwise return null String.
      Parameters:
      str -
      delimiterOfExclusiveBeginIndex -
      Returns:
      null if (str == null || str.length() == 0) OR (index < 0). (auto-generated java doc for return)
    • substringAfter

      @MayReturnNull public static String substringAfter(String str, String delimiterOfExclusiveBeginIndex)
      Returns the substring after first delimiterOfExclusiveBeginIndex if it exists, otherwise return null String.
      Parameters:
      str -
      delimiterOfExclusiveBeginIndex -
      Returns:
      null if (str == null || delimiterOfExclusiveBeginIndex == null) OR (index < 0). (auto-generated java doc for return)
    • substringAfter

      @MayReturnNull public static String substringAfter(String str, String delimiterOfExclusiveBeginIndex, int exclusiveEndIndex)
      Returns null if str == null || delimiterOfExclusiveBeginIndex == null || exclusiveEndIndex < 0, or str.indexOf(delimiterOfExclusiveBeginIndex) < 0 || str.indexOf(delimiterOfExclusiveBeginIndex) + delimiterOfExclusiveBeginIndex.length() > exclusiveEndIndex otherwise returns substring(str, index + delimiterOfExclusiveBeginIndex.length(), exclusiveEndIndex);
      Parameters:
      str -
      delimiterOfExclusiveBeginIndex -
      exclusiveEndIndex -
      Returns:
      null if (str == null || delimiterOfExclusiveBeginIndex == null || exclusiveEndIndex < 0) OR (index < 0 || index + delimiterOfExclusiveBeginIndex.length() > exclusiveEndIndex). (auto-generated java doc for return)
    • substringAfterLast

      @MayReturnNull public static String substringAfterLast(String str, char delimiterOfExclusiveBeginIndex)
      Returns the substring after last delimiterOfExclusiveBeginIndex if it exists, otherwise return null String.
      Parameters:
      str -
      delimiterOfExclusiveBeginIndex -
      Returns:
      null if (str == null || str.length() == 0) OR (index < 0). (auto-generated java doc for return)
    • substringAfterLast

      @MayReturnNull public static String substringAfterLast(String str, String delimiterOfExclusiveBeginIndex)
      Returns the substring after last delimiterOfExclusiveBeginIndex if it exists, otherwise return null String.
      Parameters:
      str -
      delimiterOfExclusiveBeginIndex -
      Returns:
      null if (str == null || delimiterOfExclusiveBeginIndex == null) OR (index < 0). (auto-generated java doc for return)
    • substringAfterLast

      @MayReturnNull public static String substringAfterLast(String str, String delimiterOfExclusiveBeginIndex, int exclusiveEndIndex)
      Returns the substring after last delimiterOfExclusiveBeginIndex if it exists, otherwise return null String.
      Parameters:
      str -
      delimiterOfExclusiveBeginIndex -
      exclusiveEndIndex -
      Returns:
      null if (str == null || delimiterOfExclusiveBeginIndex == null || exclusiveEndIndex < 0) OR (index < 0 || index + delimiterOfExclusiveBeginIndex.length() > exclusiveEndIndex). (auto-generated java doc for return)
    • substringAfterAny

      @MayReturnNull public static String substringAfterAny(String str, char... delimitersOfExclusiveBeginIndex)
      Returns the substring before any of delimitersOfExclusiveBeginIndex if it exists, otherwise return null String.
      Parameters:
      str -
      delimitersOfExclusiveBeginIndex -
      Returns:
      null if (str == null || N.isEmpty(delimitersOfExclusiveBeginIndex)). (auto-generated java doc for return)
      See Also:
    • substringAfterAny

      @MayReturnNull public static String substringAfterAny(String str, String... delimitersOfExclusiveBeginIndex)
      Returns the substring before any of delimitersOfExclusiveBeginIndex if it exists, otherwise return null String.
      Parameters:
      str -
      delimitersOfExclusiveBeginIndex -
      Returns:
      null if (str == null || N.isEmpty(delimitersOfExclusiveBeginIndex)). (auto-generated java doc for return)
      See Also:
    • substringBefore

      @MayReturnNull public static String substringBefore(String str, char delimiterOfExclusiveEndIndex)
      Returns the substring before first delimiterOfExclusiveBeginIndex if it exists, otherwise return null String.
      Parameters:
      str -
      delimiterOfExclusiveEndIndex -
      Returns:
      null if (str == null) OR (index < 0). (auto-generated java doc for return)
    • substringBefore

      @MayReturnNull public static String substringBefore(String str, String delimiterOfExclusiveEndIndex)
      Returns the substring before first delimiterOfExclusiveBeginIndex if it exists, otherwise return null String.
      Parameters:
      str -
      delimiterOfExclusiveEndIndex -
      Returns:
      null if (str == null || delimiterOfExclusiveEndIndex == null) OR (index < 0). (auto-generated java doc for return)
    • substringBefore

      @MayReturnNull public static String substringBefore(String str, int inclusiveBeginIndex, String delimiterOfExclusiveEndIndex)
      Returns the substring before first delimiterOfExclusiveBeginIndex if it exists, otherwise return null String.
      Parameters:
      str -
      inclusiveBeginIndex -
      delimiterOfExclusiveEndIndex -
      Returns:
      null if (str == null || delimiterOfExclusiveEndIndex == null || inclusiveBeginIndex < 0 || inclusiveBeginIndex > str.length()) OR (index < 0). (auto-generated java doc for return)
    • substringBeforeLast

      @MayReturnNull public static String substringBeforeLast(String str, char delimiterOfExclusiveEndIndex)
      Returns the substring before last delimiterOfExclusiveBeginIndex if it exists, otherwise return null String.
      Parameters:
      str -
      delimiterOfExclusiveEndIndex -
      Returns:
      null if (str == null || str.length() == 0) OR (index < 0). (auto-generated java doc for return)
    • substringBeforeLast

      @MayReturnNull public static String substringBeforeLast(String str, String delimiterOfExclusiveEndIndex)
      Returns the substring before last delimiterOfExclusiveBeginIndex if it exists, otherwise return null String.
      Parameters:
      str -
      delimiterOfExclusiveEndIndex -
      Returns:
      null if (str == null || delimiterOfExclusiveEndIndex == null) OR (index < 0). (auto-generated java doc for return)
    • substringBeforeLast

      @MayReturnNull public static String substringBeforeLast(String str, int inclusiveBeginIndex, String delimiterOfExclusiveEndIndex)
      Returns the substring before last delimiterOfExclusiveBeginIndex if it exists, otherwise return null String.
      Parameters:
      str -
      inclusiveBeginIndex -
      delimiterOfExclusiveEndIndex -
      Returns:
      null if (str == null || delimiterOfExclusiveEndIndex == null || inclusiveBeginIndex < 0 || inclusiveBeginIndex > str.length()) OR (index < 0 || index < inclusiveBeginIndex). (auto-generated java doc for return)
    • substringBeforeAny

      @MayReturnNull public static String substringBeforeAny(String str, char... delimitersOfExclusiveEndIndex)
      Returns the substring before any of delimitersOfExclusiveEndIndex if it exists, otherwise return null String.
      Parameters:
      str -
      delimitersOfExclusiveEndIndex -
      Returns:
      null if (str == null || N.isEmpty(delimitersOfExclusiveEndIndex)). (auto-generated java doc for return)
      See Also:
    • substringBeforeAny

      @MayReturnNull public static String substringBeforeAny(String str, String... delimitersOfExclusiveEndIndex)
      Returns the substring before any of delimitersOfExclusiveEndIndex if it exists, otherwise return null String.
      Parameters:
      str -
      delimitersOfExclusiveEndIndex -
      Returns:
      null if (str == null || N.isEmpty(delimitersOfExclusiveEndIndex)). (auto-generated java doc for return)
      See Also:
    • substringBetween

      @MayReturnNull public static String substringBetween(String str, int exclusiveBeginIndex, int exclusiveEndIndex)
      Returns null if str == null || exclusiveBeginIndex < 0 || exclusiveEndIndex < 0 || exclusiveBeginIndex >= exclusiveEndIndex || exclusiveBeginIndex >= str.length(), Otherwise returns: str.substring(exclusiveBeginIndex + 1, min(exclusiveEndIndex, str.length())).
      Parameters:
      str -
      exclusiveBeginIndex -
      exclusiveEndIndex -
      Returns:
    • substringBetween

      @MayReturnNull public static String substringBetween(String str, int exclusiveBeginIndex, char delimiterOfExclusiveEndIndex)
      Parameters:
      str -
      exclusiveBeginIndex -
      delimiterOfExclusiveEndIndex -
      Returns:
      null if (str == null || exclusiveBeginIndex < 0 || exclusiveBeginIndex >= str.length()). (auto-generated java doc for return)
      See Also:
    • substringBetween

      @MayReturnNull public static String substringBetween(String str, int exclusiveBeginIndex, String delimiterOfExclusiveEndIndex)
      Parameters:
      str -
      exclusiveBeginIndex -
      delimiterOfExclusiveEndIndex -
      Returns:
      null if (str == null || delimiterOfExclusiveEndIndex == null || exclusiveBeginIndex < 0 || exclusiveBeginIndex >= str.length()). (auto-generated java doc for return)
      See Also:
    • substringBetween

      @MayReturnNull public static String substringBetween(String str, char delimiterOfExclusiveBeginIndex, int exclusiveEndIndex)
      Parameters:
      str -
      delimiterOfExclusiveBeginIndex -
      exclusiveEndIndex -
      Returns:
      null if (str == null || exclusiveEndIndex <= 0). (auto-generated java doc for return)
      See Also:
    • substringBetween

      @MayReturnNull public static String substringBetween(String str, String delimiterOfExclusiveBeginIndex, int exclusiveEndIndex)
      Parameters:
      str -
      delimiterOfExclusiveBeginIndex -
      exclusiveEndIndex -
      Returns:
      null if (str == null || delimiterOfExclusiveBeginIndex == null || exclusiveEndIndex < 0) OR (index < 0) OR (exclusiveBeginIndex > exclusiveEndIndex). (auto-generated java doc for return)
      See Also:
    • substringBetween

      @MayReturnNull public static String substringBetween(String str, char delimiterOfExclusiveBeginIndex, char delimiterOfExclusiveEndIndex)
      Parameters:
      str -
      delimiterOfExclusiveBeginIndex -
      delimiterOfExclusiveEndIndex -
      Returns:
      null if (str == null || str.length() <= 1) OR (startIndex < 0) OR (endIndex < 0). (auto-generated java doc for return)
      See Also:
    • substringBetween

      public static String substringBetween(String str, String tag)
      Parameters:
      str -
      tag -
      Returns:
      See Also:
    • substringBetween

      public static String substringBetween(String str, String delimiterOfExclusiveBeginIndex, String delimiterOfExclusiveEndIndex)
      Parameters:
      str -
      delimiterOfExclusiveBeginIndex -
      delimiterOfExclusiveEndIndex -
      Returns:
      See Also:
    • substringBetween

      @MayReturnNull public static String substringBetween(String str, int fromIndex, String delimiterOfExclusiveBeginIndex, String delimiterOfExclusiveEndIndex)
      Parameters:
      str -
      fromIndex - start index for delimiterOfExclusive. str.indexOf(delimiterOfExclusiveBeginIndex, fromIndex)
      delimiterOfExclusiveBeginIndex -
      delimiterOfExclusiveEndIndex -
      Returns:
      null if (str == null || delimiterOfExclusiveBeginIndex == null || delimiterOfExclusiveEndIndex == null || fromIndex < 0 || fromIndex > str.length()) OR (startIndex < 0) OR (endIndex < 0). (auto-generated java doc for return)
      See Also:
    • substringsBetween

      public static List<String> substringsBetween(String str, char delimiterOfExclusiveBeginIndex, char delimiterOfExclusiveEndIndex)
      substringsBetween("3[a2[c]]2[a]", '[', ']') = [a2[c], a].
      Parameters:
      str -
      delimiterOfExclusiveBeginIndex -
      delimiterOfExclusiveEndIndex -
      Returns:
    • substringsBetween

      public static List<String> substringsBetween(String str, int fromIndex, int toIndex, char delimiterOfExclusiveBeginIndex, char delimiterOfExclusiveEndIndex)
      substringsBetween("3[a2[c]]2[a]", '[', ']') = [a2[c], a].
      Parameters:
      str -
      fromIndex -
      toIndex -
      delimiterOfExclusiveBeginIndex -
      delimiterOfExclusiveEndIndex -
      Returns:
    • substringsBetween

      public static List<String> substringsBetween(String str, String delimiterOfExclusiveBeginIndex, String delimiterOfExclusiveEndIndex)
      substringsBetween("3[a2[c]]2[a]", '[', ']') = [a2[c], a].
      Parameters:
      str -
      delimiterOfExclusiveBeginIndex -
      delimiterOfExclusiveEndIndex -
      Returns:
    • substringsBetween

      public static List<String> substringsBetween(String str, int fromIndex, int toIndex, String delimiterOfExclusiveBeginIndex, String delimiterOfExclusiveEndIndex)
      substringsBetween("3[a2[c]]2[a]", '[', ']') = [a2[c], a].
      Parameters:
      str -
      fromIndex -
      toIndex -
      delimiterOfExclusiveBeginIndex -
      delimiterOfExclusiveEndIndex -
      Returns:
    • substringBetween

      @MayReturnNull public static String substringBetween(String str, int exclusiveBeginIndex, IntUnaryOperator funcOfExclusiveEndIndex)
      Parameters:
      str -
      exclusiveBeginIndex -
      funcOfExclusiveEndIndex - exclusiveEndIndex <- funcOfExclusiveEndIndex.applyAsInt(inclusiveBeginIndex) if inclusiveBeginIndex >= 0
      Returns:
      null if (str == null || exclusiveBeginIndex < 0 || exclusiveBeginIndex >= str.length()). (auto-generated java doc for return)
      See Also:
    • substringBetween

      @MayReturnNull @Beta public static String substringBetween(String str, int exclusiveBeginIndex, BiFunction<String,Integer,Integer> funcOfExclusiveEndIndex)
      Parameters:
      str -
      exclusiveBeginIndex -
      funcOfExclusiveEndIndex - exclusiveEndIndex <- funcOfExclusiveEndIndex.apply(str, exclusiveBeginIndex) if inclusiveBeginIndex >= 0
      Returns:
      null if (str == null || exclusiveBeginIndex < 0 || exclusiveBeginIndex >= str.length()). (auto-generated java doc for return)
      See Also:
    • substringBetween

      @MayReturnNull public static String substringBetween(String str, IntUnaryOperator funcOfExclusiveBeginIndex, int exclusiveEndIndex)
      Parameters:
      str -
      funcOfExclusiveBeginIndex - exclusiveBeginIndex <- funcOfExclusiveBeginIndex.applyAsInt(exclusiveEndIndex)) if exclusiveEndIndex >= 0
      exclusiveEndIndex -
      Returns:
      null if (str == null || exclusiveEndIndex < 0). (auto-generated java doc for return)
      See Also:
    • substringBetween

      @MayReturnNull @Beta public static String substringBetween(String str, BiFunction<String,Integer,Integer> funcOfExclusiveBeginIndex, int exclusiveEndIndex)
      Parameters:
      str -
      funcOfExclusiveBeginIndex - exclusiveBeginIndex <- funcOfExclusiveBeginIndex.apply(str, exclusiveEndIndex)) if exclusiveEndIndex >= 0
      exclusiveEndIndex -
      Returns:
      null if (str == null || exclusiveEndIndex < 0). (auto-generated java doc for return)
      See Also:
    • substringBetween

      @MayReturnNull public static String substringBetween(String str, String delimiterOfExclusiveBeginIndex, IntUnaryOperator funcOfExclusiveEndIndex)
      Parameters:
      str -
      delimiterOfExclusiveBeginIndex -
      funcOfExclusiveEndIndex -
      Returns:
      null if (str == null || delimiterOfExclusiveBeginIndex == null || delimiterOfExclusiveBeginIndex.length() > str.length()) OR (index < 0). (auto-generated java doc for return)
      See Also:
    • substringBetween

      @MayReturnNull public static String substringBetween(String str, IntUnaryOperator funcOfExclusiveBeginIndex, String delimiterOfExclusiveEndIndex)
      Parameters:
      str -
      funcOfExclusiveBeginIndex - (exclusiveBeginIndex <- funcOfExclusiveBeginIndex.applyAsInt(exclusiveEndIndex))
      delimiterOfExclusiveEndIndex - (exclusiveEndIndex <- str.lastIndexOf(delimiterOfExclusiveEndIndex))
      Returns:
      null if (str == null || delimiterOfExclusiveEndIndex == null || delimiterOfExclusiveEndIndex.length() > str.length()) OR (exclusiveEndIndex < 0). (auto-generated java doc for return)
      See Also:
    • substringIndicesBetween

      public static List<int[]> substringIndicesBetween(String str, char delimiterOfExclusiveBeginIndex, char delimiterOfExclusiveEndIndex)
      substringIndicesBetween("3[a2[c]]2[a]", '[', ']') = [[2, 7], [10, 11]].
      Parameters:
      str -
      delimiterOfExclusiveBeginIndex -
      delimiterOfExclusiveEndIndex -
      Returns:
    • substringIndicesBetween

      public static List<int[]> substringIndicesBetween(String str, int fromIndex, int toIndex, char delimiterOfExclusiveBeginIndex, char delimiterOfExclusiveEndIndex)
      substringIndicesBetween("3[a2[c]]2[a]", '[', ']') = [[2, 7], [10, 11]].
      Parameters:
      str -
      fromIndex -
      toIndex -
      delimiterOfExclusiveBeginIndex -
      delimiterOfExclusiveEndIndex -
      Returns:
    • substringIndicesBetween

      public static List<int[]> substringIndicesBetween(String str, String delimiterOfExclusiveBeginIndex, String delimiterOfExclusiveEndIndex)
      substringIndicesBetween("3[a2[c]]2[a]", '[', ']') = [[2, 7], [10, 11]].
      Parameters:
      str -
      delimiterOfExclusiveBeginIndex -
      delimiterOfExclusiveEndIndex -
      Returns:
    • substringIndicesBetween

      public static List<int[]> substringIndicesBetween(String str, int fromIndex, int toIndex, String delimiterOfExclusiveBeginIndex, String delimiterOfExclusiveEndIndex)
      substringIndicesBetween("3[a2[c]]2[a]", '[', ']') = [[2, 7], [10, 11]].
      Parameters:
      str -
      fromIndex -
      toIndex -
      delimiterOfExclusiveBeginIndex -
      delimiterOfExclusiveEndIndex -
      Returns:
    • firstChar

      public static u.OptionalChar firstChar(String str)
      Parameters:
      str -
      Returns:
    • lastChar

      public static u.OptionalChar lastChar(String str)
      Parameters:
      str -
      Returns:
    • firstChars

      @Beta public static String firstChars(String str, int n)
      Returns at most first n chars of the specified String if its length is bigger than n, or an empty String "" if str is empty or null, or itself it's length equal to or less than n.
      Parameters:
      str -
      n -
      Returns:
    • lastChars

      @Beta public static String lastChars(String str, int n)
      Returns at most last n chars of the specified String if its length is bigger than n, or an empty String "" if str is empty or null, or itself it's length equal to or less than n.
      Parameters:
      str -
      n -
      Returns:
    • join

      public static String join(boolean[] a)
      Parameters:
      a -
      Returns:
    • join

      public static String join(boolean[] a, char delimiter)
      Parameters:
      a -
      delimiter -
      Returns:
    • join

      public static String join(boolean[] a, String delimiter)
      Parameters:
      a -
      delimiter -
      Returns:
    • join

      public static String join(boolean[] a, int fromIndex, int toIndex, char delimiter)
      Parameters:
      a -
      fromIndex -
      toIndex -
      delimiter -
      Returns:
    • join

      public static String join(boolean[] a, int fromIndex, int toIndex, String delimiter)
      Parameters:
      a -
      fromIndex -
      toIndex -
      delimiter -
      Returns:
    • join

      public static String join(boolean[] a, int fromIndex, int toIndex, String delimiter, String prefix, String suffix)
      Parameters:
      a -
      fromIndex -
      toIndex -
      delimiter -
      prefix -
      suffix -
      Returns:
    • join

      public static String join(char[] a)
      Parameters:
      a -
      Returns:
    • join

      public static String join(char[] a, char delimiter)
      Parameters:
      a -
      delimiter -
      Returns:
    • join

      public static String join(char[] a, String delimiter)
      Parameters:
      a -
      delimiter -
      Returns:
    • join

      public static String join(char[] a, int fromIndex, int toIndex, char delimiter)
      Parameters:
      a -
      fromIndex -
      toIndex -
      delimiter -
      Returns:
    • join

      public static String join(char[] a, int fromIndex, int toIndex, String delimiter)
      Parameters:
      a -
      fromIndex -
      toIndex -
      delimiter -
      Returns:
    • join

      public static String join(char[] a, int fromIndex, int toIndex, String delimiter, String prefix, String suffix)
      Parameters:
      a -
      fromIndex -
      toIndex -
      delimiter -
      prefix -
      suffix -
      Returns:
    • join

      public static String join(byte[] a)
      Parameters:
      a -
      Returns:
    • join

      public static String join(byte[] a, char delimiter)
      Parameters:
      a -
      delimiter -
      Returns:
    • join

      public static String join(byte[] a, String delimiter)
      Parameters:
      a -
      delimiter -
      Returns:
    • join

      public static String join(byte[] a, int fromIndex, int toIndex, char delimiter)
      Parameters:
      a -
      fromIndex -
      toIndex -
      delimiter -
      Returns:
    • join

      public static String join(byte[] a, int fromIndex, int toIndex, String delimiter)
      Parameters:
      a -
      fromIndex -
      toIndex -
      delimiter -
      Returns:
    • join

      public static String join(byte[] a, int fromIndex, int toIndex, String delimiter, String prefix, String suffix)
      Parameters:
      a -
      fromIndex -
      toIndex -
      delimiter -
      prefix -
      suffix -
      Returns:
    • join

      public static String join(short[] a)
      Parameters:
      a -
      Returns:
    • join

      public static String join(short[] a, char delimiter)
      Parameters:
      a -
      delimiter -
      Returns:
    • join

      public static String join(short[] a, String delimiter)
      Parameters:
      a -
      delimiter -
      Returns:
    • join

      public static String join(short[] a, int fromIndex, int toIndex, char delimiter)
      Parameters:
      a -
      fromIndex -
      toIndex -
      delimiter -
      Returns:
    • join

      public static String join(short[] a, int fromIndex, int toIndex, String delimiter)
      Parameters:
      a -
      fromIndex -
      toIndex -
      delimiter -
      Returns:
    • join

      public static String join(short[] a, int fromIndex, int toIndex, String delimiter, String prefix, String suffix)
      Parameters:
      a -
      fromIndex -
      toIndex -
      delimiter -
      prefix -
      suffix -
      Returns:
    • join

      public static String join(int[] a)
      Parameters:
      a -
      Returns:
    • join

      public static String join(int[] a, char delimiter)
      Parameters:
      a -
      delimiter -
      Returns:
    • join

      public static String join(int[] a, String delimiter)
      Parameters:
      a -
      delimiter -
      Returns:
    • join

      public static String join(int[] a, int fromIndex, int toIndex, char delimiter)
      Parameters:
      a -
      fromIndex -
      toIndex -
      delimiter -
      Returns:
    • join

      public static String join(int[] a, int fromIndex, int toIndex, String delimiter)
      Parameters:
      a -
      fromIndex -
      toIndex -
      delimiter -
      Returns:
    • join

      public static String join(int[] a, int fromIndex, int toIndex, String delimiter, String prefix, String suffix)
      Parameters:
      a -
      fromIndex -
      toIndex -
      delimiter -
      prefix -
      suffix -
      Returns:
    • join

      public static String join(long[] a)
      Parameters:
      a -
      Returns:
    • join

      public static String join(long[] a, char delimiter)
      Parameters:
      a -
      delimiter -
      Returns:
    • join

      public static String join(long[] a, String delimiter)
      Parameters:
      a -
      delimiter -
      Returns:
    • join

      public static String join(long[] a, int fromIndex, int toIndex, char delimiter)
      Parameters:
      a -
      fromIndex -
      toIndex -
      delimiter -
      Returns:
    • join

      public static String join(long[] a, int fromIndex, int toIndex, String delimiter)
      Parameters:
      a -
      fromIndex -
      toIndex -
      delimiter -
      Returns:
    • join

      public static String join(long[] a, int fromIndex, int toIndex, String delimiter, String prefix, String suffix)
      Parameters:
      a -
      fromIndex -
      toIndex -
      delimiter -
      prefix -
      suffix -
      Returns:
    • join

      public static String join(float[] a)
      Parameters:
      a -
      Returns:
    • join

      public static String join(float[] a, char delimiter)
      Parameters:
      a -
      delimiter -
      Returns:
    • join

      public static String join(float[] a, String delimiter)
      Parameters:
      a -
      delimiter -
      Returns:
    • join

      public static String join(float[] a, int fromIndex, int toIndex, char delimiter)
      Parameters:
      a -
      fromIndex -
      toIndex -
      delimiter -
      Returns:
    • join

      public static String join(float[] a, int fromIndex, int toIndex, String delimiter)
      Parameters:
      a -
      fromIndex -
      toIndex -
      delimiter -
      Returns:
    • join

      public static String join(float[] a, int fromIndex, int toIndex, String delimiter, String prefix, String suffix)
      Parameters:
      a -
      fromIndex -
      toIndex -
      delimiter -
      prefix -
      suffix -
      Returns:
    • join

      public static String join(double[] a)
      Parameters:
      a -
      Returns:
    • join

      public static String join(double[] a, char delimiter)
      Parameters:
      a -
      delimiter -
      Returns:
    • join

      public static String join(double[] a, String delimiter)
      Parameters:
      a -
      delimiter -
      Returns:
    • join

      public static String join(double[] a, int fromIndex, int toIndex, char delimiter)
      Parameters:
      a -
      fromIndex -
      toIndex -
      delimiter -
      Returns:
    • join

      public static String join(double[] a, int fromIndex, int toIndex, String delimiter)
      Parameters:
      a -
      fromIndex -
      toIndex -
      delimiter -
      Returns:
    • join

      public static String join(double[] a, int fromIndex, int toIndex, String delimiter, String prefix, String suffix)
      Parameters:
      a -
      fromIndex -
      toIndex -
      delimiter -
      prefix -
      suffix -
      Returns:
    • join

      public static String join(Object[] a)
      Parameters:
      a -
      Returns:
    • join

      public static String join(Object[] a, char delimiter)
      Parameters:
      a -
      delimiter -
      Returns:
    • join

      public static String join(Object[] a, String delimiter)
      Parameters:
      a -
      delimiter -
      Returns:
    • join

      public static String join(Object[] a, String delimiter, String prefix, String suffix)
      Parameters:
      a -
      delimiter -
      prefix -
      suffix -
      Returns:
    • join

      public static String join(Object[] a, String delimiter, String prefix, String suffix, boolean trim)
      Parameters:
      a -
      delimiter -
      prefix -
      suffix -
      trim -
      Returns:
    • join

      public static String join(Object[] a, int fromIndex, int toIndex, char delimiter)
      Parameters:
      a -
      fromIndex -
      toIndex -
      delimiter -
      Returns:
    • join

      public static String join(Object[] a, int fromIndex, int toIndex, char delimiter, boolean trim)
      Parameters:
      a -
      fromIndex -
      toIndex -
      delimiter -
      trim -
      Returns:
    • join

      public static String join(Object[] a, int fromIndex, int toIndex, String delimiter)
      Parameters:
      a -
      fromIndex -
      toIndex -
      delimiter -
      Returns:
    • join

      public static String join(Object[] a, int fromIndex, int toIndex, String delimiter, boolean trim)
      Parameters:
      a -
      fromIndex -
      toIndex -
      delimiter -
      trim -
      Returns:
    • join

      public static String join(Object[] a, int fromIndex, int toIndex, String delimiter, String prefix, String suffix, boolean trim)
      Parameters:
      a -
      fromIndex -
      toIndex -
      delimiter -
      prefix -
      suffix -
      trim -
      Returns:
    • join

      public static String join(Iterable<?> c)
      Parameters:
      c -
      Returns:
    • join

      public static String join(Iterable<?> c, char delimiter)
      Parameters:
      c -
      delimiter -
      Returns:
    • join

      public static String join(Iterable<?> c, String delimiter)
      Parameters:
      c -
      delimiter -
      Returns:
    • join

      public static String join(Iterable<?> c, String delimiter, String prefix, String suffix)
      Parameters:
      c -
      delimiter -
      prefix -
      suffix -
      Returns:
    • join

      public static String join(Iterable<?> c, String delimiter, String prefix, String suffix, boolean trim)
      Parameters:
      c -
      delimiter -
      prefix -
      suffix -
      trim -
      Returns:
    • join

      public static String join(Collection<?> c, int fromIndex, int toIndex, char delimiter)
      Parameters:
      c -
      fromIndex -
      toIndex -
      delimiter -
      Returns:
    • join

      public static String join(Collection<?> c, int fromIndex, int toIndex, char delimiter, boolean trim)
      Parameters:
      c -
      fromIndex -
      toIndex -
      delimiter -
      trim -
      Returns:
    • join

      public static String join(Collection<?> c, int fromIndex, int toIndex, String delimiter)
      Parameters:
      c -
      fromIndex -
      toIndex -
      delimiter -
      Returns:
    • join

      public static String join(Collection<?> c, int fromIndex, int toIndex, String delimiter, boolean trim)
      Parameters:
      c -
      fromIndex -
      toIndex -
      delimiter -
      trim -
      Returns:
    • join

      public static String join(Collection<?> c, int fromIndex, int toIndex, String delimiter, String prefix, String suffix, boolean trim)
      Parameters:
      c -
      fromIndex -
      toIndex -
      delimiter -
      prefix -
      suffix -
      trim -
      Returns:
    • join

      public static String join(Iterator<?> iter)
      Parameters:
      iter -
      Returns:
    • join

      public static String join(Iterator<?> iter, char delimiter)
      Parameters:
      iter -
      delimiter -
      Returns:
    • join

      public static String join(Iterator<?> iter, String delimiter)
      Parameters:
      iter -
      delimiter -
      Returns:
    • join

      public static String join(Iterator<?> iter, String delimiter, String prefix, String suffix)
      Parameters:
      iter -
      delimiter -
      prefix -
      suffix -
      Returns:
    • join

      public static String join(Iterator<?> iter, String delimiter, String prefix, String suffix, boolean trim)
      Parameters:
      iter -
      delimiter -
      prefix -
      suffix -
      trim -
      Returns:
    • joinEntries

      public static String joinEntries(Map<?,?> m)
      Parameters:
      m -
      Returns:
    • joinEntries

      public static String joinEntries(Map<?,?> m, char entryDelimiter)
      Parameters:
      m -
      entryDelimiter -
      Returns:
    • joinEntries

      public static String joinEntries(Map<?,?> m, String entryDelimiter)
      Parameters:
      m -
      entryDelimiter -
      Returns:
    • joinEntries

      public static String joinEntries(Map<?,?> m, char entryDelimiter, char keyValueDelimiter)
      Parameters:
      m -
      entryDelimiter -
      keyValueDelimiter -
      Returns:
    • joinEntries

      public static String joinEntries(Map<?,?> m, String entryDelimiter, String keyValueDelimiter)
      Parameters:
      m -
      entryDelimiter -
      keyValueDelimiter -
      Returns:
    • joinEntries

      public static String joinEntries(Map<?,?> m, String entryDelimiter, String keyValueDelimiter, String prefix, String suffix)
      Parameters:
      m -
      entryDelimiter -
      keyValueDelimiter -
      prefix -
      suffix -
      Returns:
    • joinEntries

      public static String joinEntries(Map<?,?> m, String entryDelimiter, String keyValueDelimiter, String prefix, String suffix, boolean trim)
      Parameters:
      m -
      entryDelimiter -
      keyValueDelimiter -
      prefix -
      suffix -
      trim -
      Returns:
    • joinEntries

      public static <K, V, E extends Exception, E2 extends Exception> String joinEntries(Map<K,V> m, String entryDelimiter, String keyValueDelimiter, String prefix, String suffix, boolean trim, Throwables.Function<? super K,?,E> keyMapper, Throwables.Function<? super V,?,E2> valueMapper) throws E, E2
      Type Parameters:
      K -
      V -
      E -
      E2 -
      Parameters:
      m -
      entryDelimiter -
      keyValueDelimiter -
      prefix -
      suffix -
      trim -
      keyMapper -
      valueMapper -
      Returns:
      Throws:
      E
      E2
    • joinEntries

      public static String joinEntries(Map<?,?> m, int fromIndex, int toIndex, char entryDelimiter)
      Parameters:
      m -
      fromIndex -
      toIndex -
      entryDelimiter -
      Returns:
    • joinEntries

      public static String joinEntries(Map<?,?> m, int fromIndex, int toIndex, char entryDelimiter, boolean trim)
      Parameters:
      m -
      fromIndex -
      toIndex -
      entryDelimiter -
      trim -
      Returns:
    • joinEntries

      public static String joinEntries(Map<?,?> m, int fromIndex, int toIndex, String entryDelimiter)
      Parameters:
      m -
      fromIndex -
      toIndex -
      entryDelimiter -
      Returns:
    • joinEntries

      public static String joinEntries(Map<?,?> m, int fromIndex, int toIndex, String entryDelimiter, boolean trim)
      Parameters:
      m -
      fromIndex -
      toIndex -
      entryDelimiter -
      trim -
      Returns:
    • joinEntries

      public static String joinEntries(Map<?,?> m, int fromIndex, int toIndex, char entryDelimiter, char keyValueDelimiter)
      Parameters:
      m -
      fromIndex -
      toIndex -
      entryDelimiter -
      keyValueDelimiter -
      Returns:
    • joinEntries

      public static String joinEntries(Map<?,?> m, int fromIndex, int toIndex, char entryDelimiter, char keyValueDelimiter, boolean trim)
      Parameters:
      m -
      fromIndex -
      toIndex -
      entryDelimiter -
      keyValueDelimiter -
      trim -
      Returns:
    • joinEntries

      public static String joinEntries(Map<?,?> m, int fromIndex, int toIndex, String entryDelimiter, String keyValueDelimiter)
      Parameters:
      m -
      fromIndex -
      toIndex -
      entryDelimiter -
      keyValueDelimiter -
      Returns:
    • joinEntries

      public static String joinEntries(Map<?,?> m, int fromIndex, int toIndex, String entryDelimiter, String keyValueDelimiter, String prefix, String suffix, boolean trim)
      Parameters:
      m -
      fromIndex -
      toIndex -
      entryDelimiter -
      keyValueDelimiter -
      prefix -
      suffix -
      trim -
      Returns:
    • concat

      public static String concat(String a, String b)
      Returns a + b.
      Parameters:
      a -
      b -
      Returns:
    • concat

      public static String concat(String a, String b, String c)
      Parameters:
      a -
      b -
      c -
      Returns:
    • concat

      public static String concat(String a, String b, String c, String d)
      Parameters:
      a -
      b -
      c -
      d -
      Returns:
    • concat

      public static String concat(String a, String b, String c, String d, String e)
      Parameters:
      a -
      b -
      c -
      d -
      e -
      Returns:
    • concat

      public static String concat(String a, String b, String c, String d, String e, String f)
      Parameters:
      a -
      b -
      c -
      d -
      e -
      f -
      Returns:
    • concat

      public static String concat(String a, String b, String c, String d, String e, String f, String g)
      Parameters:
      a -
      b -
      c -
      d -
      e -
      f -
      g -
      Returns:
    • concat

      public static String concat(String a, String b, String c, String d, String e, String f, String g, String h)
      Parameters:
      a -
      b -
      c -
      d -
      e -
      f -
      g -
      h -
      Returns:
    • concat

      public static String concat(String a, String b, String c, String d, String e, String f, String g, String h, String i)
      Parameters:
      a -
      b -
      c -
      d -
      e -
      f -
      g -
      h -
      i -
      Returns:
    • concat

      @SafeVarargs public static String concat(String... a)
      Parameters:
      a -
      Returns:
    • concat

      public static String concat(Object a, Object b)
      Returns N.toString(a) + N.toString(b).
      Parameters:
      a -
      b -
      Returns:
    • concat

      public static String concat(Object a, Object b, Object c)
      Parameters:
      a -
      b -
      c -
      Returns:
      See Also:
    • concat

      public static String concat(Object a, Object b, Object c, Object d)
      Parameters:
      a -
      b -
      c -
      d -
      Returns:
      See Also:
    • concat

      public static String concat(Object a, Object b, Object c, Object d, Object e)
      Parameters:
      a -
      b -
      c -
      d -
      e -
      Returns:
      See Also:
    • concat

      public static String concat(Object a, Object b, Object c, Object d, Object e, Object f)
      Parameters:
      a -
      b -
      c -
      d -
      e -
      f -
      Returns:
      See Also:
    • concat

      public static String concat(Object a, Object b, Object c, Object d, Object e, Object f, Object g)
      Returns N.toString(a) + N.toString(b) + N.toString(c) + N.toString(d) + N.toString(e) + N.toString(f) + N.toString(g).
      Parameters:
      a -
      b -
      c -
      d -
      e -
      f -
      g -
      Returns:
      See Also:
    • concat

      public static String concat(Object a, Object b, Object c, Object d, Object e, Object f, Object g, Object h)
      Returns N.toString(a) + N.toString(b) + N.toString(c) + N.toString(d) + N.toString(e) + N.toString(f) + N.toString(g) + N.toString(h).
      Parameters:
      a -
      b -
      c -
      d -
      e -
      f -
      g -
      h -
      Returns:
      See Also:
    • concat

      public static String concat(Object a, Object b, Object c, Object d, Object e, Object f, Object g, Object h, Object i)
      Returns N.toString(a) + N.toString(b) + N.toString(c) + N.toString(d) + N.toString(e) + N.toString(f) + N.toString(g) + N.toString(h) + N.toString(i).
      Parameters:
      a -
      b -
      c -
      d -
      e -
      f -
      g -
      h -
      i -
      Returns:
      See Also:
    • lenientFormat

      public static String lenientFormat(String template, Object... args)
      Copied from Google Guava
      Returns the given template string with each occurrence of "%s" replaced by the corresponding argument value from args; or, if the placeholder and argument counts do not match, returns a best-effort form of that string. Will not throw an exception under normal conditions.

      Note: For most string-formatting needs, use String.format, PrintWriter.format, and related methods. These support the full range of format specifiers, and alert you to usage errors by throwing IllegalFormatException.

      In certain cases, such as outputting debugging information or constructing a message to be used for another unchecked exception, an exception during string formatting would serve little purpose except to supplant the real information you were trying to provide. These are the cases this method is made for; it instead generates a best-effort string with all supplied argument values present. This method is also useful in environments such as GWT where String.format is not available. As an example, method implementations of the Preconditions class use this formatter, for both of the reasons just discussed.

      Warning: Only the exact two-character placeholder sequence "%s" is recognized.

      Parameters:
      template - a string containing zero or more "%s" placeholder sequences. null is treated as the four-character string "null".
      args - the arguments to be substituted into the message template. The first argument specified is substituted for the first occurrence of "%s" in the template, and so forth. A null argument is converted to the four-character string "null"; non-null values are converted to strings using Object.toString().
      Returns:
      Since:
      25.1
    • reverse

      public static String reverse(String str)
      Parameters:
      str -
      Returns:
      the specified String if it's null or empty.
    • reverseDelimited

      public static String reverseDelimited(String str, char delimiter)

      Reverses a String that is delimited by a specific character.

      The Strings between the delimiters are not reversed. Thus java.lang.String becomes String.lang.java (if the delimiter is '.').

       Strings.reverseDelimited(null, *)      = null
       Strings.reverseDelimited("", *)        = ""
       Strings.reverseDelimited("a.b.c", 'x') = "a.b.c"
       Strings.reverseDelimited("a.b.c", ".") = "c.b.a"
       
      Parameters:
      str - the String to reverse, may be null
      delimiter - the delimiter character to use
      Returns:
      the specified String if it's null or empty.
      Since:
      2.0
    • reverseDelimited

      public static String reverseDelimited(String str, String delimiter)
      Parameters:
      str -
      delimiter -
      Returns:
      the specified String if it's null or empty.
    • sort

      public static String sort(String str)
      Returns a new sorted String if the specified str is not null or empty, otherwise the specified str is returned.
      Parameters:
      str -
      Returns:
      the specified String if it's null or empty.
    • rotate

      public static String rotate(String str, int shift)

      Rotate (circular shift) a String of shift characters.

      • If shift > 0, right circular shift (ex : ABCDEF => FABCDE)
      • If shift < 0, left circular shift (ex : ABCDEF => BCDEFA)
       Strings.rotate(null, *)        = null
       Strings.rotate("", *)          = ""
       Strings.rotate("abcdefg", 0)   = "abcdefg"
       Strings.rotate("abcdefg", 2)   = "fgabcde"
       Strings.rotate("abcdefg", -2)  = "cdefgab"
       Strings.rotate("abcdefg", 7)   = "abcdefg"
       Strings.rotate("abcdefg", -7)  = "abcdefg"
       Strings.rotate("abcdefg", 9)   = "fgabcde"
       Strings.rotate("abcdefg", -9)  = "cdefgab"
       
      Parameters:
      str - the String to rotate, may be null
      shift - number of time to shift (positive : right shift, negative : left shift)
      Returns:
      the rotated String, or the original String if shift == 0, or null if null String input
      Since:
      3.5
    • shuffle

      public static String shuffle(String str)
      Parameters:
      str -
      Returns:
    • shuffle

      public static String shuffle(String str, Random rnd)
      Parameters:
      str -
      rnd -
      Returns:
      the specified String if it's null or empty.
    • overlay

      public static String overlay(String str, String overlay, int start, int end)

      Overlays part of a String with another String.

       Strings.overlay(null, "abc", 0, 0)          = "abc"
       Strings.overlay("", "abc", 0, 0)          = "abc"
       Strings.overlay("abcdef", null, 2, 4)     = "abef"
       Strings.overlay("abcdef", "", 2, 4)       = "abef"
       Strings.overlay("abcdef", "zzzz", 2, 4)   = "abzzzzef"
       
      Parameters:
      str - the String to do overlaying in, may be null
      overlay - the String to overlay, may be null
      start - the position to start overlaying at
      end - the position to stop overlaying before
      Returns:
      overlayed String, "" if null String input
      Since:
      2.0
    • parseBoolean

      public static boolean parseBoolean(String str)
      Returns a Boolean with a value represented by the specified string. The Boolean returned represents a true value if the string argument is not null and is equal, ignoring case, to the string "true".
      Parameters:
      str - a string.
      Returns:
    • parseChar

      public static char parseChar(String str)
      Parses the char.
      Parameters:
      str -
      Returns:
    • parseByte

      @Deprecated public static byte parseByte(String str) throws NumberFormatException
      Deprecated.
      replaced by Numbers.toByte(String)
      Returns the value by calling Byte.valueOf(String) if str is not null, otherwise, the default value 0 for byte is returned.
      Parameters:
      str -
      Returns:
      Throws:
      NumberFormatException - If the string is not a parsable byte.
      See Also:
    • parseShort

      @Deprecated public static short parseShort(String str) throws NumberFormatException
      Deprecated.
      replaced by Numbers.toShort(String)
      Returns the value by calling Short.valueOf(String) if str is not null, otherwise, the default value 0 for short is returned.
      Parameters:
      str -
      Returns:
      Throws:
      NumberFormatException - If the string is not a parsable short.
      See Also:
    • parseInt

      @Deprecated public static int parseInt(String str) throws NumberFormatException
      Deprecated.
      replaced by Numbers.toInt(String)
      Returns the value by calling Integer.valueOf(String) if str is not null, otherwise, the default value 0 for int is returned.
      Parameters:
      str -
      Returns:
      Throws:
      NumberFormatException - If the string is not a parsable int.
      See Also:
    • parseLong

      @Deprecated public static long parseLong(String str) throws NumberFormatException
      Deprecated.
      replaced by Numbers.toLong(String)
      Returns the value by calling Long.valueOf(String) if str is not null, otherwise, the default value 0 for long is returned.
      Parameters:
      str -
      Returns:
      Throws:
      NumberFormatException - If the string is not a parsable long.
      See Also:
    • parseFloat

      @Deprecated public static float parseFloat(String str) throws NumberFormatException
      Deprecated.
      replaced by Numbers.toFloat(String)
      Returns the value by calling Float.valueOf(String) if str is not null, otherwise, the default value 0f for float is returned.
      Parameters:
      str -
      Returns:
      Throws:
      NumberFormatException - If the string is not a parsable float.
      See Also:
    • parseDouble

      @Deprecated public static double parseDouble(String str) throws NumberFormatException
      Deprecated.
      replaced by Numbers.toDouble(String)
      Returns the value by calling Double.valueOf(String) if str is not null, otherwise, the default value 0d for double is returned.
      Parameters:
      str -
      Returns:
      Throws:
      NumberFormatException - If the string is not a parsable double.
      See Also:
    • base64Encode

      public static String base64Encode(byte[] binaryData)
      Base 64 encode.
      Parameters:
      binaryData -
      Returns:
    • base64EncodeString

      public static String base64EncodeString(String str)
      Parameters:
      str -
      Returns:
    • base64EncodeUtf8String

      public static String base64EncodeUtf8String(String str)
      Parameters:
      str -
      Returns:
    • base64Decode

      public static byte[] base64Decode(String base64String)
      Base 64 decode.
      Parameters:
      base64String -
      Returns:
    • base64DecodeToString

      public static String base64DecodeToString(String base64String)
      Base 64 decode to string.
      Parameters:
      base64String -
      Returns:
    • base64DecodeToUtf8String

      public static String base64DecodeToUtf8String(String base64String)
      Parameters:
      base64String -
      Returns:
    • base64UrlEncode

      public static String base64UrlEncode(byte[] binaryData)
      Base 64 url encode.
      Parameters:
      binaryData -
      Returns:
    • base64UrlDecode

      public static byte[] base64UrlDecode(String base64String)
      Base 64 url decode.
      Parameters:
      base64String -
      Returns:
    • base64UrlDecodeToString

      public static String base64UrlDecodeToString(String base64String)
      Base 64 url decode to string.
      Parameters:
      base64String -
      Returns:
    • base64UrlDecodeToUtf8String

      public static String base64UrlDecodeToUtf8String(String base64String)
      Parameters:
      base64String -
      Returns:
    • urlEncode

      public static String urlEncode(Object parameters)
      Parameters:
      parameters -
      Returns:
    • urlEncode

      public static String urlEncode(Object parameters, Charset charset)
      Parameters:
      parameters -
      charset -
      Returns:
    • urlDecode

      public static Map<String,String> urlDecode(String urlQuery)
      Parameters:
      urlQuery -
      Returns:
    • urlDecode

      public static Map<String,String> urlDecode(String urlQuery, Charset charset)
      Parameters:
      urlQuery -
      charset -
      Returns:
    • urlDecode

      public static <T> T urlDecode(String urlQuery, Class<? extends T> targetClass)
      Type Parameters:
      T -
      Parameters:
      urlQuery -
      targetClass -
      Returns:
    • urlDecode

      public static <T> T urlDecode(String urlQuery, Charset charset, Class<? extends T> targetClass)
      Type Parameters:
      T -
      Parameters:
      urlQuery -
      charset -
      targetClass -
      Returns:
    • isBase64

      public static boolean isBase64(byte octet)
      Returns whether or not the octet is in the base 64 alphabet.
      Parameters:
      octet - The value to test
      Returns:
      true if the value is defined in the the base 64 alphabet, false otherwise.
      Since:
      1.4
    • isBase64

      public static boolean isBase64(byte[] arrayOctet)
      Tests a given byte array to see if it contains only valid characters within the Base64 alphabet. Currently the method treats whitespace as valid.
      Parameters:
      arrayOctet - byte array to test
      Returns:
      true if all bytes are valid characters in the Base64 alphabet or if the byte array is empty; false, otherwise
      Since:
      1.5
    • isBase64

      public static boolean isBase64(String base64)
      Tests a given String to see if it contains only valid characters within the Base64 alphabet. Currently the method treats whitespace as valid.
      Parameters:
      base64 - String to test
      Returns:
      true if all characters in the String are valid characters in the Base64 alphabet or if the String is empty; false, otherwise
      Since:
      1.5
    • findFirstEmailAddress

      public static String findFirstEmailAddress(String str)
      Return the first found email address or null if there is no emal address found the specified String.
      Parameters:
      str -
      Returns:
      See Also:
    • findAllEmailAddresses

      public static List<String> findAllEmailAddresses(String str)
      Return all the found email addresses or an empty List if there is no emal address found the specified String.
      Parameters:
      str -
      Returns:
      See Also:
    • copyThenTrim

      @Beta public static String[] copyThenTrim(String[] strs)
      Parameters:
      strs -
      Returns:
      See Also:
    • copyThenStrip

      @Beta public static String[] copyThenStrip(String[] strs)
      Parameters:
      strs -
      Returns:
      See Also: