java中trim()

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/lihua5419/article/details/82850895

trim() 方法用于删除字符串的头尾空白符。

	public static void main(String[] args) {
                String str = new String("  https://blog.csdn.net/lihua5419  ");
	        System.out.print("博客地址 :" );
	        System.out.println( str );

	        System.out.print("删除头尾空白后地址 :" );
	        System.out.println( str.trim() );
	}

猜你喜欢

转载自blog.csdn.net/lihua5419/article/details/82850895