Java中字符串去除空格
1. str.trim(); 去掉首尾空格 2. str.replace(" ", ""); 去掉所有空格,包括首尾、中间 String str = " hell o "; ...
1. str.trim(); 去掉首尾空格 2. str.replace(" ", ""); 去掉所有空格,包括首尾、中间 String str = " hell o "; ...