public static String method(String str)
{
//int start = 0,end = str.length()-1;
for (int start =0,end=str.length()-1;start<=end && str.charAt(start)==' ',start<=end && str.charAt(end)==' ';start++,end-- )
{
return str.substring(start,end+1);
}
/*
while (start<=end && str.charAt(start)==' ')
{
start++;
}
while (start<=end && str.charAt(end)==' ')
{
end--;
}
return str.substring(start,end+1);
*/
}
我想用for循环写实现/**/号注释的内容怎么写? |