package guavaTest;
public class StringTest {
public static void main(String[] args) {
System.out.println("sCriptcom".replaceAll("(?i)script",""));
System.out.println("SCriptcom".replaceAll("S(?i)cript",""));
System.out.println("SCriptcom".replaceAll("s(?i)cript",""));
}
}
image.png
使用org.apache.commons.lang.WordUtils提供的方法,实现首字母大小写
最新的方法已经迁移到stringutils工具包中
String string = "TransactionService";
System.out.println(StringUtils.uncapitalize(string));
网友评论