zoukankan      html  css  js  c++  java
  • String类型

    1  char
        charAt(int index)           返回指定索引处的 char 值。
                   index - char 值的索引。
    2 string
           concat(String str) 
              将指定字符串连接到此字符串的结尾。
                     str - 连接到此 String 结尾的 String。 

            substring(int beginIndex) 
              返回一个新的字符串,它是此字符串的一个子字符串。
                beginIndex - 起始索引(包括)。
    3  boolean 
            endsWith(String suffix) 
              测试此字符串是否以指定的后缀结束。 
                  suffix - 后缀。 

            startsWith(String prefix) 
              测试此字符串是否以指定的前缀开始。
     
           equals(Object anObject) 
              将此字符串与指定的对象比较。
             anObject - 与此 String 进行比较的对象

            equalsIgnoreCase(String anotherString) 
              将此 String 与另一个 String 比较,不考虑大小写。
              anotherString - 与此 String 进行比较的 String。 

    4 int
           indexOf(int ch) 
              返回指定字符在此字符串中第一次出现处的索引。
                 ch - 一个字符

            indexOf(int ch, int fromIndex) 
              返回在此字符串中第一次出现指定字符处的索引,从指定的索引开始搜索。
              ch - 一个字符   fromIndex - 开始搜索的索引。

            indexOf(String str) 
              返回指定子字符串在此字符串中第一次出现处的索引。
             str-任意字符串

            indexOf(String str, int fromIndex) 
              返回指定子字符串在此字符串中第一次出现处的索引,从指定的索引开始。
              str - 要搜索的子字符串。fromIndex - 开始搜索的索引位置。
         public int lastIndexOf(int ch) 
        public int lastIndexOf(iint ch, int fromIndex)  
        public int lastIndexOf(String str) 
        public int lastIndexOf(String str, int fromIndex)    

         length() 
              返回此字符串的长度。

  • 相关阅读:
    Django第一天
    约束条件 表之间的关系
    数据类型
    初始vue
    JQ事件和事件对象
    Jquery的属性操作和DOM操作
    浏览器对象BOM
    Swiper实现全屏视觉差轮播
    Swiper开篇
    JSON
  • 原文地址:https://www.cnblogs.com/jg22/p/4396335.html
Copyright © 2011-2022 走看看