Java trim() 方法
trim() 方法用于删除字符串的头尾空白符
语法
public String trim()
参数
无
返回值
删除头尾空白符的字符串
实例
public class Test { public static void main(String args[]) { String Str = new String(" www.facesoho.com "); System.out.print("原始值 :" ); System.out.println( Str ); System.out.print("删除头尾空白 :" ); System.out.println( Str.trim() ); } }
以上程序执行结果为:
原始值 : www.facesoho.com 删除头尾空白 :www.facesoho.com
尊贵的董事大人
英文标题不为空时 视为本栏投稿
需要关键字 描述 英文标题