String 一经创建,不可更改,每次更改都是创建新对象,销毁旧对象
StringBuilder 创建后可修改,多线程不安全
StringBuffer 创建后可修改,多线程安全
StringBuffer函数列表
StringBuffer()
StringBuffer(int capacity)
StringBuffer(String string)
StringBuffer(CharSequence cs) StringBuffer append(boolean b)
StringBuffer append(int i)
StringBuffer append(long l)
StringBuffer append(float f)
StringBuffer append(double d)
synchronized StringBuffer append(char ch)
synchronized StringBuffer append(char[] chars)
synchronized StringBuffer append(char[] chars, int start, int length)
synchronized StringBuffer append(Object obj)
synchronized StringBuffer append(String string)
synchronized StringBuffer append(StringBuffer sb)
synchronized StringBuffer append(CharSequence s)
synchronized StringBuffer append(CharSequence s, int start, int end)
StringBuffer appendCodePoint(int codePoint)
int capacity()
synchronized char charAt(int index)
synchronized int codePointAt(int index)
synchronized int codePointBefore(int index)
synchronized int codePointCount(int beginIndex, int endIndex)
synchronized StringBuffer delete(int start, int end)
synchronized StringBuffer deleteCharAt(int location)
synchronized void ensureCapacity(int min)
synchronized void getChars(int start, int end, char[] buffer, int idx)
synchronized int indexOf(String subString, int start)
int indexOf(String string)
StringBuffer insert(int index, boolean b)
StringBuffer insert(int index, int i)
StringBuffer insert(int index, long l)
StringBuffer insert(int index, float f)
StringBuffer insert(int index, double d)
synchronized StringBuffer insert(int index, char ch)
synchronized StringBuffer insert(int index, char[] chars)
synchronized StringBuffer insert(int index, char[] chars, int start, int length)
synchronized StringBuffer insert(int index, String string)
StringBuffer insert(int index, Object obj)
synchronized StringBuffer insert(int index, CharSequence s)
synchronized StringBuffer insert(int index, CharSequence s, int start, int end)
int lastIndexOf(String string)
synchronized int lastIndexOf(String subString, int start)
int length()
synchronized int offsetByCodePoints(int index, int codePointOffset)
synchronized StringBuffer replace(int start, int end, String string)
synchronized StringBuffer reverse()
synchronized void setCharAt(int index, char ch)
synchronized void setLength(int length)
synchronized CharSequence subSequence(int start, int end)
synchronized String substring(int start)
synchronized String substring(int start, int end)
synchronized String toString()
synchronized void trimToSize()