String类方法的总结.doc_第1页
String类方法的总结.doc_第2页
String类方法的总结.doc_第3页
全文预览已结束

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

String类方法总结No.方法名称类型描述字符串与字符1public String(char value)构造将全部的字符数组内容变为字符串2public String(char value, int offset, int count)构造将部分字符数组变为字符串,offset表示开始点,count表示要操作的长度3public char charAt(int index)普通取得指定索引位置上的字符4public char toCharArray()普通将字符串转换为字符数组字符串与字节5public String(byte bytes)构造将全部的字节数组变为字符串6public String(byte bytes, int offset, int length)构造将部分的字节数组变为字符串7public byte getBytes()普通将字符串变为字节数组8public byte getBytes(String charsetName) throws UnsupportedEncodingException普通字符串转码操作字符串比较9public boolean equals(String anObject)普通区分大小写的相等判断10public boolean equalsIgnoreCase(String anotherString)普通不区分大小写比较是否相等11public int compareTo(String anotherString)普通比较两个字符串的大小字符串查找12public boolean contains(String s)普通查找指定的子字符串是否存在,JDK 1.5之后有13public int indexOf(String str)普通从头查找指定字符串的位置,找不到返回-114public int indexOf(String str, int fromIndex)普通由指定位置向后查找字符串的位置,找不到返回-115public int lastIndexOf(String str)普通由后向前查找字符串的位置,找不到返回-116public int lastIndexOf(String str, int fromIndex)普通从指定位置由后向前查找17public boolean startsWith(String prefix)普通判断是否以指定的字符串开头18public boolean startsWith(String prefix, int toffset)普通从指定位置判断是否以指定字符串开头,JDK 1.719public boolean endsWith(String suffix)普通判断是否以指定的字符串结尾字符串替换操作20public String replaceAll(String regex, String replacement)普通全部替换21public String replaceFirst(String regex, String replacement)普通替换首个字符串截取22public String substring(int beginIndex)普通从指定位置截取到结尾23public String substring(int beginIndex, int endIndex)普通截取指定范围的内容字符串拆分24public String split(String regex)普通按照指定的字符串全拆分25public String split(String regex, int limit)普通拆分为指定的长度其他方法26public boolean isEmpty()普通判断是否为空字符串()27public int length()普通取得字符串长度28publicStringtrim()普通去掉左右空格29public String toLowerCase()普通将全部字符串转小写30public String toUp

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论