zoukankan      html  css  js  c++  java
  • 8.String API

    1.char    charAt(int index)   返回给定位置的代码  用于取已知位置对应的字符

    2.int  codePointAt(int index)  返回给定位置的码点(Unicode)

    3.int  offsetByCodePoints(int index,int cpCount) 返回从Index代码点开始位移cpCount位后的码点索引

    4.boolean  equals(String other) 如果字符串与 other 相等 返回true

    5.boolean  equalsIgnoreCase(String other) 如果字符串与other相等(忽略大小写) 返回true

    6.boolean  startWith(String other)如果字符串从other开始 返回true

    7.boolean  endWith(String other)如果字符串以other结尾 返回true

    8.int  indexOf(String a)返回在字符串中a出现的第一个位置 不存在返回-1

    9.int  indexOf(String a,int startIndex)返回从startIndex开始a在原字符串中的第一个下标 不存在返回-1

    10.int  indexOf(int a)返回与a下标相同的字符在原字符串中第一个下标 不存在返回-1

    11.int  indexOf(int a,index startIndex)返回从startIndex开始下标a字符在元字符穿中的第一个下标 不存在返回-1

    12.int  indexOf(String a)返回在字符串中a出现的最后一个位置 不存在返回-1

    13.int  indexOf(String a,int startIndex)返回从startIndex开始a在原字符串中的最后一个下标 不存在返回-1

    14.int  indexOf(int a)返回与a下标相同的字符在原字符串中最后一个下标 不存在返回-1

    15.int  indexOf(int a,index startIndex)返回从startIndex开始下标a字符在元字符穿中的最后一个下标 不存在返回-1

    16.int  length()返回字符串长度

    17.String  replace(String oldString,String newString) 返回将原字符串中oldString替换为newString后的新生成的字符串

    18.String  subString(int beginIndex)返回原字符串从下标beginIndex开始的全部字符截取后的新字符串

    19.String  subString(int beginIndex,endIndex)返回原字符串从下标beginIndex开始endIndex-1结束截取后的新字符串

    20.String  toLowerCase()返回一个将原字符串中的大写全部改为小写后的新字符串

    21.String  toUpperCase()返回一个将原字符串中的小写全部改为大写后的新字符串

    22.String  trim() 返回一个将原字符串开头结尾处的空格移除后的新字符串(不移除中间的空格)

  • 相关阅读:
    57.适合自己的就是最好的
    45.懂得放弃
    ASP.NET碎知识点
    app性能测试理论基础一篇
    记一次踩坑docker+Jenkins+python3.6.8+gitee
    IT测试人从浓密到稀疏的的发量之路
    一天基本上没什么效率
    如此复杂的心情,如此失落的感觉…
    String.Replace 方法 (String, String)
    《见与不见》原题《班扎古鲁白玛的沉默》 作者:扎西拉姆·多多
  • 原文地址:https://www.cnblogs.com/mokpiet/p/13793511.html
Copyright © 2011-2022 走看看