依賴
<dependency><groupId>org.apache.commons</groupId><artifactId>commons-lang3</artifactId><version>3.12.0</version>
</dependency>
示例
// 包名
import org.apache.commons.lang3.StringUtils;// 處理字符串,將首尾的花括號移除
String oldStr = "{[Hello,word]}";
String newStr = StringUtils.strip(oldStr, "{}");
System.out.println(newStr);
// [Hello,word]
參考
StringUtils.strip(String str, String stripChars)刪除首尾指定的字符串