/**
* 截取两遍指定的字符
* @param character
* @param symbol
* @return
*/
public static String trim(String character, String symbol){
if(character == null || symbol == null || character.length() == 0 || symbol.length() == 0){
return character;
}
//先截取左边
character = (character.substring(0,1).equals(symbol)) ? character.substring(1) : character;
//截取右边
Integer len = character.length();
character = len >0 && (character.substring(len-1,len).equals(symbol)) ? character.substring(0,len-1) : character;
//返回截取后的
return character;
}
截取字符串两边指定的字符串
最新推荐文章于 2020-09-10 13:39:42 发布