java 去掉字符串右侧空格
public static String rightTrim(String str) {
String regex = "(.*\\S+)(\\s+$)";
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(str);
if (m.matches()) {
str = m.group(1);
}
return str;
}
李小家