Java零碎知识点

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(" ","");

常见日期格式化转换符

Java零碎知识点_第1张图片
Paste_Image.png

replace与replaceAll的区别
[ java中split()特殊符号"." "|" "*" "" "]" ](http://blog.csdn.net/myfmyfmyfmyf/article/details/37592711)
Java日期时间及其格式化

你可能感兴趣的:(Java零碎知识点)