码迷,mamicode.com
首页 > 其他好文 > 详细

String

时间:2014-10-10 00:22:31      阅读:209      评论:0      收藏:0      [点我收藏+]

标签:os   ar   sp   ad   ef   new   bs   as   ui   

1, .intern() method, return String

call .intern() method, will try to add current string into the pool, if the pool already has the string, the method will return the ref to the existing string; otherwise, it will add the string into the pool.

2, Reverse a String

new StringBuilder(str).reverse().toString();

3, change case

.toLowerCase(), .toUpperCase()

4, Compare

.equalsIgnoreCase(String anotherStr) return boolean.

.compareTo(String anotherStr) return int 0 or negative or positive.

.compareToIgnoreCase(String anotherStr).

5, to chars

.toCharArray() return char[]

.charAt(int index) return char

 

String

标签:os   ar   sp   ad   ef   new   bs   as   ui   

原文地址:http://www.cnblogs.com/chayu3/p/4014590.html

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