String trim() ,去除当前字符串两边的空白字符

package seday01;
/**
* String trim()
* 去除当前字符串两边的空白字符
* @author xingsir
*/
public class TrimDemo {

public static void main(String[] args) {
String str=" Hello Java ";
String trim=str.trim();//去空格操作
System.out.println(str);//打印没去空格结果
System.out.println(trim);//打印去空格后结果
}

}

猜你喜欢

转载自www.cnblogs.com/xingsir/p/11957833.html