java中im()函数的作⽤trim  /[trɪm] / 英⽂意思:整理,修理,修剪,整齐的
trim()的作⽤:去掉字符串⾸尾的空格。
trim函数的作用是删除文本的什么空格public static void main(String arg[]){
String a=" hello world ";
String b="hello world";
System.out.println(b.equals(a));
im();//去掉字符串⾸尾的空格
System.out.println(a.equals(b));
}
执⾏结果:a: hello world  ,falsea:hello world,true
trim()的源代码:
public String trim() {
int len = value.length;
int st = 0;
char[] val = value;    /* avoid getfield opcode */
while ((st < len) && (val[st] <= ' ')) {
st++;
}
while ((st < len) && (val[len - 1] <= ' ')) {
len--;
}
return ((st > 0) || (len < value.length)) ? substring(st, len) : this;
}