常用的API
1 String : final修饰的类.
①:String转Date
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = format.parse("需要转换的日期字符串");
②:indexOf("xxx");
返回xxx在字符串中首次出现的位置,若没有,则返回-1;
③:substring(4);
从索引4开始截取字符串到结束.
substring(2,5); 从索引2开始截取字符串,到5(不包含)结束,左闭右开;
④:split(RE);
以正则表达式切割字符串,返回String[],若字符串末尾还有分隔符,不会继续切割.
split(RE,-1),末尾有分隔符会继续切割;
⑤:.trim();
去掉字符串两头的空格;
⑥:replace(str1,str2);
用str2替换原字符串中所有的str1;