Methods.java /** * 经常会有用到的几个方法 */.replace("http://", "https://")//将字符串中带有***替换成****StringUtils.isBlank(test.getxxx())//判断是否为空String.startsWith("http://")//方法返回true,用于判断字
/**
* 经常会有用到的几个方法
*/
.replace("http://", "https://")//将字符串中带有***替换成****
StringUtils.isBlank(test.getxxx())//判断是否为空
String.startsWith("http://")//方法返回true,用于判断字符串中是否带有http://
int i = String.indexOf("http://")//方法返回int,用于判断字符串中是否带有http://
String.equals(xxx)//判断字符串是否与xxx相等
String.contains(xxx) //方法返回true,当且仅当此字符串包含指定的xxx
str=str.substring(int beginIndex)//截取掉str从首字母起长度为beginIndex的字符串,将剩余字符串赋值给str;
str=str.substring(int beginIndex,int endIndex)//截取str中从beginIndex开始至endIndex结束时的字符串,并将其赋值给str;
Id=StringUtils.substringBefore(Id, "_");//截取Id中第一个"_"之前的内容;
Id=StringUtils.substringBeforeLast(Id, "_");//截取Id中最后一个"_"之前的内容;
StringJoiner sj=new StringJoiner(",");
System.out.println(sj.add("a").add("b").add("c"))
//输出:a,b,c适用于循环拼接
String.split(sourceStr,maxSplit)
String.split(sourceStr)
//参数说明:sourceStr是被分割的字符串,maxSplit是最大的分割数
//返回值说明:split函数的返回值是一个字符串数组String[]
//注意:(\\,)、(\\|)使用
JSONObject jsonObject = JSONObject.fromObject(Object);//转换成json串
//Set用法
public static String[] array_unique(String[] a) {
Set
set = new HashSet
(); set.addAll(Arrays.asList(a)); return set.toArray(new String[0]); }
