1. 程式人生 > >JavaSE8基礎 String trim 去除字符串兩端的空格

JavaSE8基礎 String trim 去除字符串兩端的空格

優秀 div alt jdk print code [] ges http



os :windows7 x64
jdk:jdk-8u131-windows-x64
ide:Eclipse Oxygen Release (4.7.0)


code:

package jizuiku.t02;

public class Demo3 {
	public static void main(String[] args) {
		String s1 = " h ell wor l d  ";
		
		//去除字符串兩頭的空格
		System.out.println(s1.trim());
	}
}


result:
技術分享


Java優秀,值得學習。
學習資源:API手冊+Java源碼+清凈的心地。

JavaSE8基礎 String trim 去除字符串兩端的空格