首页 > 其他 > 详细

String的常用方法

时间:2019-11-27 21:39:23      阅读:60      评论:0      收藏:0      [点我收藏+]

int length():返回字符串的长度

char charAt(int index): 返回某索引处的字符

boolean  isEmpty() 判断是否空字符串

String  toLowerCase()

String toUpperCase()

String trim()返回字符串的副本,忽略前导空白和尾部空白

boolean equals(Object obj) 比较字符串的内容是否相同

boolean equalsIgnoreCase(String anotherString) 与 equals方法类似,忽略大小写

String concat(String str)将指定字符串连接到此字符串的结尾 等价于用“+”

int compareTo(String anotherString)比较两个字符串的大小

String substring(int beginIndex,int endIndex) 

int indexOf

int lastIndexof

 

String与char【】的转换

str.toCharArray() 

String的常用方法

原文:https://www.cnblogs.com/ergePython/p/11945449.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!