美文网首页
StringBuffer

StringBuffer

作者: wangyou2550 | 来源:发表于2018-12-21 22:30 被阅读0次

    方法

    1. append(string s)
    2. reverse()
    3. public insert(int offset, int i)
      将 int 参数的字符串表示形式插入此序列中
    4. replace(int start, int end, String str)
      使用给定 String 中的字符替换此序列的子字符串中的字符。

    与string类似的方法

    1. int capacity() 返回当前容量
    2. char charAt(int index)
      返回此序列中指定索引处的 char 值
    3. void ensureCapacity(int minimumCapacity)
      确保容量至少等于指定的最小值
    4. oid getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)
      将字符从此序列复制到目标字符数组 dst
    5. int indexOf(String str)
      返回第一次出现的指定子字符串在该字符串中的索引
    6. int indexOf(String str, int fromIndex)
      从指定的索引处开始,返回第一次出现的指定子字符串在该字符串中的索引
    7. int length()
      返回长度(字符数)
    8. String substring(int start)
      返回一个新的 String,它包含此字符序列当前所包含的字符子序列。
    9. String substring(int start, int end)
      返回一个新的 String,它包含此序列当前所包含的字符子序列。
    10. String toString()
      返回此序列中数据的字符串表示形式

    相关文章

      网友评论

          本文标题:StringBuffer

          本文链接:https://www.haomeiwen.com/subject/jyhbkqtx.html