码迷,mamicode.com
首页 > 编程语言 > 详细

java中trim()函数是什么

时间:2016-12-14 18:23:20      阅读:171      评论:0      收藏:0      [点我收藏+]

标签:class   .com   static   分享   空格   前缀和   http   文件   字符串前缀   

trim() 去除字符串前缀和后缀空格

文件名:Test.java ,编译通过

public class Test

{

    public static void main(String args[])

    {

  String str="  str  ";

  System.out.println("|"+str+"|");

  String strl=str.trim(); //去除strl前缀和后缀空格

  System.out.println("|"+strl+"|");

    }

}

技术分享

 

java中trim()函数是什么

标签:class   .com   static   分享   空格   前缀和   http   文件   字符串前缀   

原文地址:http://www.cnblogs.com/liu2816350343/p/6180250.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!