租用问题

质量为本、客户为根、勇于拼搏、务实创新

< 返回租用问题列表

java中stringbuffer的常用有什么方法,java中stringbuffer的常用方法

发布时间:2023-10-16 18:05:56

java中stringbuffer的经常使用有甚么方法

  1. append(String str): 将指定字符串添加到StringBuffer的末尾。
  2. insert(int offset, String str): 在指定位置插入指定字符串。
  3. delete(int start, int end): 删除指定范围内的字符。
  4. replace(int start, int end, String str): 将指定范围内的字符替换为指定字符串。
  5. reverse(): 反转StringBuffer中的字符顺序。
  6. substring(int start): 返回从指定位置开始到末尾的子字符串。
  7. substring(int start, int end): 返回指定范围内的子字符串。
  8. length(): 返回StringBuffer对象的长度(即字符数)。
  9. capacity(): 返回StringBuffer对象确当前容量。
  10. setLength(int newLength): 设置StringBuffer对象的长度。
  11. ensureCapacity(int minimumCapacity): 确保StringBuffer对象的容量最少等于指定的最小值。
  12. toString(): 将StringBuffer对象转换为String类型。