首页 > 代码库 > JAVA字符串处理工具类

JAVA字符串处理工具类

com.google.common.base.Strings
 
public static String nullToEmpty(String string)
public static boolean isNullOrEmpty(String string)
public static String padStart(String string, int minLength, char padChar)
  例如: Strings.padStart("123", 16, ‘0‘)     输出:0000000000000123
public static String padEnd(String string, int minLength, char padChar)  
  例如: Strings.padEnd("123", 16, ‘0‘)     输出:1230000000000000
 public static String repeat(String string, int count)             
  例如: Strings.repeat("A", 16)    输出:AAAAAAAAAAAAAAAA
public static String commonPrefix(CharSequence a, CharSequence b)      
  例如: Strings.commonPrefix("AAAB","AAC")    输出:AA
public static String commonSuffix(CharSequence a, CharSequence b)     
  例如: Strings.commonSuffix("AAABG","AACG")    输出:G

JAVA字符串处理工具类