posts - 66,  comments - 40,  trackbacks - 0

Returns a copy of the string, with leading and trailing whitespace omitted.

If this String object represents an empty character sequence, or the first and last characters of character sequence represented by this String object both have codes greater than '\u0020' (the space character), then a reference to this String object is returned.

Otherwise, if there is no character with a code greater than '\u0020' in the string, then a new String object representing an empty string is created and returned.

Otherwise, let k be the index of the first character in the string whose code is greater than '\u0020', and let m be the index of the last character in the string whose code is greater than '\u0020'. A new String object is created, representing the substring of this string that begins with the character at index k and ends with the character at index m-that is, the result of this.substring(km+1).

This method may be used to trim whitespace (as defined above) from the beginning and end of a string.

Returns:
A copy of this string with leading and trailing white space removed, or this string if it has no leading or trailing white space.
posted on 2006-05-08 09:27 happytian 阅读(1555) 评论(2)  编辑  收藏

FeedBack:
# re: String java.lang.String.trim()[未登录]
2008-08-31 14:54 | 过客
可以自己写点不 。。擦,文档上的copy来有意思么。。》??  回复  更多评论
  
# re: String java.lang.String.trim()[未登录]
2008-09-08 22:10 | happytian
:-),这些本来就是自己经历过的问题,解决了,再把这些资料收集一下,下次碰到了好找,自己写是自己的爱好,自己收集也是为了方便  回复  更多评论
  

只有注册用户登录后才能发表评论。


网站导航:
 
<2024年11月>
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567

Welcome here, my friend!

常用链接

留言簿(12)

随笔档案(66)

文章分类

文章档案(63)

web

最新随笔

搜索

  •  

积分与排名

  • 积分 - 88670
  • 排名 - 646

最新评论

阅读排行榜

评论排行榜