1.去除字符串中的空格
① trim() 用法:str.trim()
② java.util.StringTokenizer 用法:
String s = "hello world";
StringTokenizer str = new StringTokenizer(s," ");
StringBuffer sb = new StringBuffer();
while (str.hasMoreTokens()){
sb.append(str.nextToken());
}
System.out.print(sb.toString());
③replaceAll() 用法 str.replaceAll(" ","");
常见日期格式化转换符
Paste_Image.pngreplace与replaceAll的区别
[ java中split()特殊符号"." "|" "*" "" "]" ](http://blog.csdn.net/myfmyfmyfmyf/article/details/37592711)
Java日期时间及其格式化
网友评论