相关方法的使用

BeanUtils.copyProperties("要转换的类", "转换后的类");  
subString的用法,两个参数的用法,(起始位置,终止位置),如果确定了起始位置和终止位置的数,可以配置indexof()使用
例子
StringBuilder s = new StringBuilder("swwq--2.44");
String s1 = s.substring(s.indexOf("q"), s.indexOf("2"));
System.out.println(s1);
hootool的相关用法
DateUtil.parse(),两个参数第一个为时间,第二个为想要呈现的时间格式
例子

DateTime date = DateUtil.parse(DateUtil.now(), "yyyymmddHHMM");
System.out.println(date);

FileUtil.readString(),两个参数,第一个为文件地址,第二个为编码格式”utf-8“,”GBK“等等,返回字符串
例子
String s2 = FileUtil.readString("C:\\Users\\Administrator\\Desktop\\spring.txt", "utf-8");
System.out.println(s2);

File.separator代表系统目录的分隔符,不同的系统中显示不同,/或者\这种,也有可能是//等,
为了解决跨平台性问题

    windows下
     File file1 = new File ("C:\tmp\test.txt");
    linux下
     File file2 = new File ("/tmp/test.txt");

     如果要考虑跨平台,则最好是这么写:
     File myFile = new File("C:" + File.separator + "tmp" + File.separator, "test.txt");

  jsonArray.toList()方法,参数为类名.class,返回List集合,json类型的数组转换为集合

    例子

    public class User{
       String name;

     int age;

    。。。。

  strUtil的相关用法

  strUtil.isBlank();括号内参数为string类型的数据,返回boolean类型,该方法判断字符是否为空白,包括不可见字符空格

  strUtil.isEmpty()跟上述方法类似,不同的是不包括空格,只包含null,两者的区别是如果一个页面有空格,isEmpty还是认为什么都没有,返回true,而isblank认为有数据,即空格类型的数据。返回false。判断文件用isempty方法

        strUtil.hasBlank();括号内参数为string类型的数据,返回boolean类型,该方法判断字符串是否包含空格。

  strUtil.startWith();两个参数,第一个为字符串名称,第二个为字符串。返回boolean类型。

  strUtil.removesuffix(),去掉指定的后缀,strUtil。removePrefix()去掉指定的前缀

  例子

  

  StringBuilder s = new StringBuilder("swwq--2.44");
 String s2 = StrUtil.removeSuffix(s, "2.4");
 System.out.println(s2);
原文地址:https://www.cnblogs.com/qiannianguyao/p/11930263.html