class StringTest
{
public static void main(String[] args)
{
String s = " abcde ";
s = myTrim(s);
System.out.println(s);
}
//去除字符串丙端的空格
public static String myTrim(String str)
{
int start = 0,end = str.length()-1;
while(start<=end && str.charAt(start)=='')
start++;
while(start<=end && str.charAt(end)=='')
end--;
return str.subString(start,end+1);
}
}
怎么编译都是好多错误,请大家看看我哪里写错了,是字符串除去空格的 |
|