尽管不知道LZ是怎么想的,,不过LZ还是看一下我的吧
public class NumTest {
public static void main(String[] args) {
String s = " a c d ";
// System.out.println(s.trim());
s = myTrim(s);
System.out.println(s);
}
public static String myTrim(String s) {
StringBuilder sb = new StringBuilder();
String str = null;
for (int i = 0; i < s.length(); i++) {
str = s.substring(i,i+1);
if (!str.equals(" ")) {
sb.append(str);
}
}
return sb.toString();
}
}
我也困了.. 准备睡觉..
|