Class StringUtils

java.lang.Object
com.alibaba.druid.util.StringUtils

public class StringUtils extends Object
Author:
sandzhang[sandzhangtoo@gmail.com]
  • Method Details

    • subStringToInteger

      public static Integer subStringToInteger(String src, String start, String to)
      Example: subString("12345","1","4")=23
      Parameters:
      src - the source string from which to extract the substring
      start - the starting point of the substring
      to - the ending point of the substring
      Returns:
      the extracted substring converted to an Integer, or null if any of the input strings is null
    • subString

      public static String subString(String src, String start, String to)
      Example: subString("abcd","a","c")="b"
      Parameters:
      src - the source string from which to extract the substring
      start - null while start from index=0
      to - null while to index=src.length
      Returns:
      the extracted substring, or null if any of the input strings is null
    • subString

      public static String subString(String src, String start, String to, boolean toLast)
      Example: subString("abcdc","a","c",true)="bcd"
      Parameters:
      src - the source string from which to extract the substring
      start - null while start from index=0
      to - null while to index=src.length
      toLast - true while to index=src.lastIndexOf(to)
      Returns:
      the extracted substring, or null if any of the input strings is null, or if the start/end points are invalid
    • stringToInteger

      public static Integer stringToInteger(String in)
      Converts a string representation of an integer to an Integer object.
      Parameters:
      in - the input string to be converted (can be null)
      Returns:
      the Integer object parsed from the input string, or null if the input is null, empty, or not a valid integer
    • equals

      public static boolean equals(String a, String b)
    • equalsIgnoreCase

      public static boolean equalsIgnoreCase(String a, String b)
    • isEmpty

      public static boolean isEmpty(CharSequence value)
    • lowerHashCode

      public static int lowerHashCode(String text)
    • isNumber

      public static boolean isNumber(String str)
    • isNumber

      public static boolean isNumber(char[] chars)
    • formatDateTime19

      public static String formatDateTime19(long millis, TimeZone timeZone)
    • removeNameQuotes

      public static String removeNameQuotes(String s)
    • replaceAll

      public static String replaceAll(String s, String src, String dest)