string的那些操作

//获取路径中最后的\\之前的内容
String storePath = StringUtils.substringBeforeLast("C:\\Users\\mzc\\Desktop\\test.xlsx","\\")
//判断字符串中是否含有另一个字符串,有则替换掉,没有使字符串为空
String a = "qwerty"
a = a.contains("qwe") ?a.replace("qwe", "") : "";
 
posted @ 2019-09-26 15:54  小时不识药  阅读(116)  评论(0)    收藏  举报