java中StringBuffer类的常用方法怎么用? java中StringBuffer类的常用方法有有哪些

java\u4e2dStringBuffer\u7c7b\u7684\u5e38\u7528\u65b9\u6cd5\u6709\u6709\u54ea\u4e9b\uff1f

StingBuffer\u7c7b\u5e38\u7528\u7684\u4e00\u4e9b\u65b9\u6cd5\u6709\uff1a
append( ),\u8868\u793a\u5c06\u62ec\u53f7\u91cc\u7684\u67d0\u79cd\u6570\u636e\u7c7b\u578b\u7684\u53d8\u91cf\u63d2\u5165\u67d0\u4e00\u5e8f\u5217\u4e2d
charAt( ),\u8fd4\u56de\u6b64\u5e8f\u5217\u4e2d\u6307\u5b9a\u7d22\u5f15\u5904\u7684 char \u503c
toString( ),\u8fd4\u56de\u6b64\u5e8f\u5217\u4e2d\u6570\u636e\u7684\u5b57\u7b26\u4e32\u8868\u793a\u5f62\u5f0f\u3002
subString( ), \u8fd4\u56de\u4e00\u4e2a\u65b0\u7684 String\uff0c\u5b83\u5305\u542b\u6b64\u5e8f\u5217\u5f53\u524d\u6240\u5305\u542b\u7684\u5b57\u7b26\u5b50\u5e8f\u5217\u3002
delete( ),\u79fb\u9664\u6b64\u5e8f\u5217\u7684\u5b50\u5b57\u7b26\u4e32\u4e2d\u7684\u5b57\u7b26\u3002
deletecharAt (), \u79fb\u9664\u6b64\u5e8f\u5217\u6307\u5b9a\u4f4d\u7f6e\u7684 char\u3002
insert( ),\u8868\u793a\u5c06\u62ec\u53f7\u91cc\u7684\u67d0\u79cd\u6570\u636e\u7c7b\u578b\u7684\u53d8\u91cf\u63d2\u5165\u67d0\u4e00\u5e8f\u5217\u4e2d
reverse( ),\u5c06\u6b64\u5b57\u7b26\u5e8f\u5217\u7528\u5176\u53cd\u8f6c\u5f62\u5f0f\u53d6\u4ee3
setCharAt(int index, char ch ),\u5c06\u7ed9\u5b9a\u7d22\u5f15\u5904\u7684\u5b57\u7b26\u8bbe\u7f6e\u4e3a ch\u3002
trimToSize (),\u5c1d\u8bd5\u51cf\u5c11\u7528\u4e8e\u5b57\u7b26\u5e8f\u5217\u7684\u5b58\u50a8\u7a7a\u95f4\u3002
StringBufferappend(boolean b)
\u5c06 boolean \u53c2\u6570\u7684\u5b57\u7b26\u4e32\u8868\u793a\u5f62\u5f0f\u8ffd\u52a0\u5230\u5e8f\u5217\u3002 StringBufferappend(char c)
\u5c06 char \u53c2\u6570\u7684\u5b57\u7b26\u4e32\u8868\u793a\u5f62\u5f0f\u8ffd\u52a0\u5230\u6b64\u5e8f\u5217\u3002 StringBufferappend(char[] str)
\u5c06 char \u6570\u7ec4\u53c2\u6570\u7684\u5b57\u7b26\u4e32\u8868\u793a\u5f62\u5f0f\u8ffd\u52a0\u5230\u6b64\u5e8f\u5217\u3002 StringBufferappend(char[] str, int offset, int len)
\u5c06 char \u6570\u7ec4\u53c2\u6570\u7684\u5b50\u6570\u7ec4\u7684\u5b57\u7b26\u4e32\u8868\u793a\u5f62\u5f0f\u8ffd\u52a0\u5230\u6b64\u5e8f\u5217\u3002 StringBufferappend(CharSequence s)
\u5c06\u6307\u5b9a\u7684 CharSequence \u8ffd\u52a0\u5230\u8be5\u5e8f\u5217\u3002 StringBufferappend(CharSequence s, int start, int end)
\u5c06\u6307\u5b9a CharSequence \u7684\u5b50\u5e8f\u5217\u8ffd\u52a0\u5230\u6b64\u5e8f\u5217\u3002 StringBufferappend(double d)
\u5c06 double \u53c2\u6570\u7684\u5b57\u7b26\u4e32\u8868\u793a\u5f62\u5f0f\u8ffd\u52a0\u5230\u6b64\u5e8f\u5217\u3002 StringBufferappend(float f)
\u5c06 float \u53c2\u6570\u7684\u5b57\u7b26\u4e32\u8868\u793a\u5f62\u5f0f\u8ffd\u52a0\u5230\u6b64\u5e8f\u5217\u3002 StringBufferappend(int i)
\u5c06 int \u53c2\u6570\u7684\u5b57\u7b26\u4e32\u8868\u793a\u5f62\u5f0f\u8ffd\u52a0\u5230\u6b64\u5e8f\u5217\u3002 StringBufferappend(long lng)
\u5c06 long \u53c2\u6570\u7684\u5b57\u7b26\u4e32\u8868\u793a\u5f62\u5f0f\u8ffd\u52a0\u5230\u6b64\u5e8f\u5217\u3002 StringBufferappend(Object obj)
\u8ffd\u52a0 Object \u53c2\u6570\u7684\u5b57\u7b26\u4e32\u8868\u793a\u5f62\u5f0f\u3002 StringBufferappend(String str)
\u5c06\u6307\u5b9a\u7684\u5b57\u7b26\u4e32\u8ffd\u52a0\u5230\u6b64\u5b57\u7b26\u5e8f\u5217\u3002 StringBufferappend(StringBuffer sb)
\u5c06\u6307\u5b9a\u7684 StringBuffer \u8ffd\u52a0\u5230\u6b64\u5e8f\u5217\u4e2d\u3002 StringBufferappendCodePoint(int codePoint)
\u5c06 codePoint \u53c2\u6570\u7684\u5b57\u7b26\u4e32\u8868\u793a\u5f62\u5f0f\u8ffd\u52a0\u5230\u6b64\u5e8f\u5217\u3002 intcapacity()
\u8fd4\u56de\u5f53\u524d\u5bb9\u91cf\u3002 charcharAt(int index)
\u8fd4\u56de\u6b64\u5e8f\u5217\u4e2d\u6307\u5b9a\u7d22\u5f15\u5904\u7684 char \u503c\u3002 intcodePointAt(int index)
\u8fd4\u56de\u6307\u5b9a\u7d22\u5f15\u5904\u7684\u5b57\u7b26\uff08\u7edf\u4e00\u4ee3\u7801\u70b9\uff09\u3002 intcodePointBefore(int index)
\u8fd4\u56de\u6307\u5b9a\u7d22\u5f15\u524d\u7684\u5b57\u7b26\uff08\u7edf\u4e00\u4ee3\u7801\u70b9\uff09\u3002 intcodePointCount(int beginIndex, int endIndex)
\u8fd4\u56de\u6b64\u5e8f\u5217\u6307\u5b9a\u6587\u672c\u8303\u56f4\u5185\u7684\u7edf\u4e00\u4ee3\u7801\u70b9\u3002 StringBufferdelete(int start, int end)
\u79fb\u9664\u6b64\u5e8f\u5217\u7684\u5b50\u5b57\u7b26\u4e32\u4e2d\u7684\u5b57\u7b26\u3002 StringBufferdeleteCharAt(int index)
\u79fb\u9664\u6b64\u5e8f\u5217\u6307\u5b9a\u4f4d\u7f6e\u7684 char\u3002 voidensureCapacity(int minimumCapacity)
\u786e\u4fdd\u5bb9\u91cf\u81f3\u5c11\u7b49\u4e8e\u6307\u5b9a\u7684\u6700\u5c0f\u503c\u3002 voidgetChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)
\u5c06\u5b57\u7b26\u4ece\u6b64\u5e8f\u5217\u590d\u5236\u5230\u76ee\u6807\u5b57\u7b26\u6570\u7ec4 dst\u3002 intindexOf(String str)
\u8fd4\u56de\u7b2c\u4e00\u6b21\u51fa\u73b0\u7684\u6307\u5b9a\u5b50\u5b57\u7b26\u4e32\u5728\u8be5\u5b57\u7b26\u4e32\u4e2d\u7684\u7d22\u5f15\u3002 intindexOf(String str, int fromIndex)
\u4ece\u6307\u5b9a\u7684\u7d22\u5f15\u5904\u5f00\u59cb\uff0c\u8fd4\u56de\u7b2c\u4e00\u6b21\u51fa\u73b0\u7684\u6307\u5b9a\u5b50\u5b57\u7b26\u4e32\u5728\u8be5\u5b57\u7b26\u4e32\u4e2d\u7684\u7d22\u5f15\u3002 StringBufferinsert(int offset, boolean b)
\u5c06 boolean \u53c2\u6570\u7684\u5b57\u7b26\u4e32\u8868\u793a\u5f62\u5f0f\u63d2\u5165\u6b64\u5e8f\u5217\u4e2d\u3002 StringBufferinsert(int offset, char c)
\u5c06 char \u53c2\u6570\u7684\u5b57\u7b26\u4e32\u8868\u793a\u5f62\u5f0f\u63d2\u5165\u6b64\u5e8f\u5217\u4e2d\u3002 StringBufferinsert(int offset, char[] str)
\u5c06 char \u6570\u7ec4\u53c2\u6570\u7684\u5b57\u7b26\u4e32\u8868\u793a\u5f62\u5f0f\u63d2\u5165\u6b64\u5e8f\u5217\u4e2d\u3002 StringBufferinsert(int index, char[] str, int offset, int len)
\u5c06\u6570\u7ec4\u53c2\u6570 str \u7684\u5b50\u6570\u7ec4\u7684\u5b57\u7b26\u4e32\u8868\u793a\u5f62\u5f0f\u63d2\u5165\u6b64\u5e8f\u5217\u4e2d\u3002 StringBufferinsert(int dstOffset, CharSequence s)
\u5c06\u6307\u5b9a CharSequence \u63d2\u5165\u6b64\u5e8f\u5217\u4e2d\u3002 StringBufferinsert(int dstOffset, CharSequence s, int start, int end)
\u5c06\u6307\u5b9a CharSequence \u7684\u5b50\u5e8f\u5217\u63d2\u5165\u6b64\u5e8f\u5217\u4e2d\u3002 StringBufferinsert(int offset, double d)
\u5c06 double \u53c2\u6570\u7684\u5b57\u7b26\u4e32\u8868\u793a\u5f62\u5f0f\u63d2\u5165\u6b64\u5e8f\u5217\u4e2d\u3002 StringBufferinsert(int offset, float f)
\u5c06 float \u53c2\u6570\u7684\u5b57\u7b26\u4e32\u8868\u793a\u5f62\u5f0f\u63d2\u5165\u6b64\u5e8f\u5217\u4e2d\u3002 StringBufferinsert(int offset, int i)
\u5c06 int \u53c2\u6570\u7684\u5b57\u7b26\u4e32\u8868\u793a\u5f62\u5f0f\u63d2\u5165\u6b64\u5e8f\u5217\u4e2d\u3002 StringBufferinsert(int offset, long l)
\u5c06 long \u53c2\u6570\u7684\u5b57\u7b26\u4e32\u8868\u793a\u5f62\u5f0f\u63d2\u5165\u6b64\u5e8f\u5217\u4e2d\u3002 StringBufferinsert(int offset, Object obj)
\u5c06 Object \u53c2\u6570\u7684\u5b57\u7b26\u4e32\u8868\u793a\u5f62\u5f0f\u63d2\u5165\u6b64\u5b57\u7b26\u5e8f\u5217\u4e2d\u3002 StringBufferinsert(int offset, String str)
\u5c06\u5b57\u7b26\u4e32\u63d2\u5165\u6b64\u5b57\u7b26\u5e8f\u5217\u4e2d\u3002 intlastIndexOf(String str)
\u8fd4\u56de\u6700\u53f3\u8fb9\u51fa\u73b0\u7684\u6307\u5b9a\u5b50\u5b57\u7b26\u4e32\u5728\u6b64\u5b57\u7b26\u4e32\u4e2d\u7684\u7d22\u5f15\u3002 intlastIndexOf(String str, int fromIndex)
\u8fd4\u56de\u6700\u540e\u4e00\u6b21\u51fa\u73b0\u7684\u6307\u5b9a\u5b50\u5b57\u7b26\u4e32\u5728\u6b64\u5b57\u7b26\u4e32\u4e2d\u7684\u7d22\u5f15\u3002 intlength()
\u8fd4\u56de\u957f\u5ea6\uff08\u5b57\u7b26\u6570\uff09\u3002 intoffsetByCodePoints(int index, int codePointOffset)
\u8fd4\u56de\u6b64\u5e8f\u5217\u4e2d\u7684\u4e00\u4e2a\u7d22\u5f15\uff0c\u8be5\u7d22\u5f15\u662f\u4ece\u7ed9\u5b9a index \u504f\u79fb codePointOffset \u4e2a\u4ee3\u7801\u70b9\u540e\u5f97\u5230\u7684\u3002 StringBufferreplace(int start, int end, String str)
\u4f7f\u7528\u7ed9\u5b9a String \u4e2d\u7684\u5b57\u7b26\u66ff\u6362\u6b64\u5e8f\u5217\u7684\u5b50\u5b57\u7b26\u4e32\u4e2d\u7684\u5b57\u7b26\u3002 StringBufferreverse()
\u5c06\u6b64\u5b57\u7b26\u5e8f\u5217\u7528\u5176\u53cd\u8f6c\u5f62\u5f0f\u53d6\u4ee3\u3002 voidsetCharAt(int index, char ch)
\u5c06\u7ed9\u5b9a\u7d22\u5f15\u5904\u7684\u5b57\u7b26\u8bbe\u7f6e\u4e3a ch\u3002 voidsetLength(int newLength)
\u8bbe\u7f6e\u5b57\u7b26\u5e8f\u5217\u7684\u957f\u5ea6\u3002 CharSequencesubSequence(int start, int end)
\u8fd4\u56de\u4e00\u4e2a\u65b0\u7684\u5b57\u7b26\u5e8f\u5217\uff0c\u8be5\u5b57\u7b26\u5e8f\u5217\u662f\u6b64\u5e8f\u5217\u7684\u5b50\u5e8f\u5217\u3002 Stringsubstring(int start)
\u8fd4\u56de\u4e00\u4e2a\u65b0\u7684 String\uff0c\u5b83\u5305\u542b\u6b64\u5b57\u7b26\u5e8f\u5217\u5f53\u524d\u6240\u5305\u542b\u7684\u5b57\u7b26\u5b50\u5e8f\u5217\u3002 Stringsubstring(int start, int end)
\u8fd4\u56de\u4e00\u4e2a\u65b0\u7684 String\uff0c\u5b83\u5305\u542b\u6b64\u5e8f\u5217\u5f53\u524d\u6240\u5305\u542b\u7684\u5b57\u7b26\u5b50\u5e8f\u5217\u3002 StringtoString()
\u8fd4\u56de\u6b64\u5e8f\u5217\u4e2d\u6570\u636e\u7684\u5b57\u7b26\u4e32\u8868\u793a\u5f62\u5f0f\u3002 voidtrimToSize()
\u5c1d\u8bd5\u51cf\u5c11\u7528\u4e8e\u5b57\u7b26\u5e8f\u5217\u7684\u5b58\u50a8\u7a7a\u95f4\u3002

StingBuffer\u7c7b\u5e38\u7528\u7684\u4e00\u4e9b\u65b9\u6cd5\u6709\uff1a
append( ),\u8868\u793a\u5c06\u62ec\u53f7\u91cc\u7684\u67d0\u79cd\u6570\u636e\u7c7b\u578b\u7684\u53d8\u91cf\u63d2\u5165\u67d0\u4e00\u5e8f\u5217\u4e2d
charAt( ),\u8fd4\u56de\u6b64\u5e8f\u5217\u4e2d\u6307\u5b9a\u7d22\u5f15\u5904\u7684 char \u503c
toString( ),\u8fd4\u56de\u6b64\u5e8f\u5217\u4e2d\u6570\u636e\u7684\u5b57\u7b26\u4e32\u8868\u793a\u5f62\u5f0f\u3002
subString( ), \u8fd4\u56de\u4e00\u4e2a\u65b0\u7684 String\uff0c\u5b83\u5305\u542b\u6b64\u5e8f\u5217\u5f53\u524d\u6240\u5305\u542b\u7684\u5b57\u7b26\u5b50\u5e8f\u5217\u3002
delete( ),\u79fb\u9664\u6b64\u5e8f\u5217\u7684\u5b50\u5b57\u7b26\u4e32\u4e2d\u7684\u5b57\u7b26\u3002
deletecharAt (), \u79fb\u9664\u6b64\u5e8f\u5217\u6307\u5b9a\u4f4d\u7f6e\u7684 char\u3002
insert( ),\u8868\u793a\u5c06\u62ec\u53f7\u91cc\u7684\u67d0\u79cd\u6570\u636e\u7c7b\u578b\u7684\u53d8\u91cf\u63d2\u5165\u67d0\u4e00\u5e8f\u5217\u4e2d
reverse( ),\u5c06\u6b64\u5b57\u7b26\u5e8f\u5217\u7528\u5176\u53cd\u8f6c\u5f62\u5f0f\u53d6\u4ee3
setCharAt(int index, char ch ),\u5c06\u7ed9\u5b9a\u7d22\u5f15\u5904\u7684\u5b57\u7b26\u8bbe\u7f6e\u4e3a ch\u3002
trimToSize (),\u5c1d\u8bd5\u51cf\u5c11\u7528\u4e8e\u5b57\u7b26\u5e8f\u5217\u7684\u5b58\u50a8\u7a7a\u95f4\u3002
StringBufferappend(boolean b)
\u5c06 boolean \u53c2\u6570\u7684\u5b57\u7b26\u4e32\u8868\u793a\u5f62\u5f0f\u8ffd\u52a0\u5230\u5e8f\u5217\u3002 StringBufferappend(char c)
\u5c06 char \u53c2\u6570\u7684\u5b57\u7b26\u4e32\u8868\u793a\u5f62\u5f0f\u8ffd\u52a0\u5230\u6b64\u5e8f\u5217\u3002 StringBufferappend(char[] str)
\u5c06 char \u6570\u7ec4\u53c2\u6570\u7684\u5b57\u7b26\u4e32\u8868\u793a\u5f62\u5f0f\u8ffd\u52a0\u5230\u6b64\u5e8f\u5217\u3002 StringBufferappend(char[] str, int offset, int len)
\u5c06 char \u6570\u7ec4\u53c2\u6570\u7684\u5b50\u6570\u7ec4\u7684\u5b57\u7b26\u4e32\u8868\u793a\u5f62\u5f0f\u8ffd\u52a0\u5230\u6b64\u5e8f\u5217\u3002 StringBufferappend(CharSequence s)
\u5c06\u6307\u5b9a\u7684 CharSequence \u8ffd\u52a0\u5230\u8be5\u5e8f\u5217\u3002 StringBufferappend(CharSequence s, int start, int end)
\u5c06\u6307\u5b9a CharSequence \u7684\u5b50\u5e8f\u5217\u8ffd\u52a0\u5230\u6b64\u5e8f\u5217\u3002 StringBufferappend(double d)
\u5c06 double \u53c2\u6570\u7684\u5b57\u7b26\u4e32\u8868\u793a\u5f62\u5f0f\u8ffd\u52a0\u5230\u6b64\u5e8f\u5217\u3002 StringBufferappend(float f)
\u5c06 float \u53c2\u6570\u7684\u5b57\u7b26\u4e32\u8868\u793a\u5f62\u5f0f\u8ffd\u52a0\u5230\u6b64\u5e8f\u5217\u3002 StringBufferappend(int i)
\u5c06 int \u53c2\u6570\u7684\u5b57\u7b26\u4e32\u8868\u793a\u5f62\u5f0f\u8ffd\u52a0\u5230\u6b64\u5e8f\u5217\u3002 StringBufferappend(long lng)
\u5c06 long \u53c2\u6570\u7684\u5b57\u7b26\u4e32\u8868\u793a\u5f62\u5f0f\u8ffd\u52a0\u5230\u6b64\u5e8f\u5217\u3002 StringBufferappend(Object obj)
\u8ffd\u52a0 Object \u53c2\u6570\u7684\u5b57\u7b26\u4e32\u8868\u793a\u5f62\u5f0f\u3002 StringBufferappend(String str)
\u5c06\u6307\u5b9a\u7684\u5b57\u7b26\u4e32\u8ffd\u52a0\u5230\u6b64\u5b57\u7b26\u5e8f\u5217\u3002 StringBufferappend(StringBuffer sb)
\u5c06\u6307\u5b9a\u7684 StringBuffer \u8ffd\u52a0\u5230\u6b64\u5e8f\u5217\u4e2d\u3002 StringBufferappendCodePoint(int codePoint)
\u5c06 codePoint \u53c2\u6570\u7684\u5b57\u7b26\u4e32\u8868\u793a\u5f62\u5f0f\u8ffd\u52a0\u5230\u6b64\u5e8f\u5217\u3002 intcapacity()
\u8fd4\u56de\u5f53\u524d\u5bb9\u91cf\u3002 charcharAt(int index)
\u8fd4\u56de\u6b64\u5e8f\u5217\u4e2d\u6307\u5b9a\u7d22\u5f15\u5904\u7684 char \u503c\u3002 intcodePointAt(int index)
\u8fd4\u56de\u6307\u5b9a\u7d22\u5f15\u5904\u7684\u5b57\u7b26\uff08\u7edf\u4e00\u4ee3\u7801\u70b9\uff09\u3002 intcodePointBefore(int index)
\u8fd4\u56de\u6307\u5b9a\u7d22\u5f15\u524d\u7684\u5b57\u7b26\uff08\u7edf\u4e00\u4ee3\u7801\u70b9\uff09\u3002 intcodePointCount(int beginIndex, int endIndex)
\u8fd4\u56de\u6b64\u5e8f\u5217\u6307\u5b9a\u6587\u672c\u8303\u56f4\u5185\u7684\u7edf\u4e00\u4ee3\u7801\u70b9\u3002 StringBufferdelete(int start, int end)
\u79fb\u9664\u6b64\u5e8f\u5217\u7684\u5b50\u5b57\u7b26\u4e32\u4e2d\u7684\u5b57\u7b26\u3002 StringBufferdeleteCharAt(int index)
\u79fb\u9664\u6b64\u5e8f\u5217\u6307\u5b9a\u4f4d\u7f6e\u7684 char\u3002 voidensureCapacity(int minimumCapacity)
\u786e\u4fdd\u5bb9\u91cf\u81f3\u5c11\u7b49\u4e8e\u6307\u5b9a\u7684\u6700\u5c0f\u503c\u3002 voidgetChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)
\u5c06\u5b57\u7b26\u4ece\u6b64\u5e8f\u5217\u590d\u5236\u5230\u76ee\u6807\u5b57\u7b26\u6570\u7ec4 dst\u3002 intindexOf(String str)
\u8fd4\u56de\u7b2c\u4e00\u6b21\u51fa\u73b0\u7684\u6307\u5b9a\u5b50\u5b57\u7b26\u4e32\u5728\u8be5\u5b57\u7b26\u4e32\u4e2d\u7684\u7d22\u5f15\u3002 intindexOf(String str, int fromIndex)
\u4ece\u6307\u5b9a\u7684\u7d22\u5f15\u5904\u5f00\u59cb\uff0c\u8fd4\u56de\u7b2c\u4e00\u6b21\u51fa\u73b0\u7684\u6307\u5b9a\u5b50\u5b57\u7b26\u4e32\u5728\u8be5\u5b57\u7b26\u4e32\u4e2d\u7684\u7d22\u5f15\u3002 StringBufferinsert(int offset, boolean b)
\u5c06 boolean \u53c2\u6570\u7684\u5b57\u7b26\u4e32\u8868\u793a\u5f62\u5f0f\u63d2\u5165\u6b64\u5e8f\u5217\u4e2d\u3002 StringBufferinsert(int offset, char c)
\u5c06 char \u53c2\u6570\u7684\u5b57\u7b26\u4e32\u8868\u793a\u5f62\u5f0f\u63d2\u5165\u6b64\u5e8f\u5217\u4e2d\u3002 StringBufferinsert(int offset, char[] str)
\u5c06 char \u6570\u7ec4\u53c2\u6570\u7684\u5b57\u7b26\u4e32\u8868\u793a\u5f62\u5f0f\u63d2\u5165\u6b64\u5e8f\u5217\u4e2d\u3002 StringBufferinsert(int index, char[] str, int offset, int len)
\u5c06\u6570\u7ec4\u53c2\u6570 str \u7684\u5b50\u6570\u7ec4\u7684\u5b57\u7b26\u4e32\u8868\u793a\u5f62\u5f0f\u63d2\u5165\u6b64\u5e8f\u5217\u4e2d\u3002 StringBufferinsert(int dstOffset, CharSequence s)
\u5c06\u6307\u5b9a CharSequence \u63d2\u5165\u6b64\u5e8f\u5217\u4e2d\u3002 StringBufferinsert(int dstOffset, CharSequence s, int start, int end)
\u5c06\u6307\u5b9a CharSequence \u7684\u5b50\u5e8f\u5217\u63d2\u5165\u6b64\u5e8f\u5217\u4e2d\u3002 StringBufferinsert(int offset, double d)
\u5c06 double \u53c2\u6570\u7684\u5b57\u7b26\u4e32\u8868\u793a\u5f62\u5f0f\u63d2\u5165\u6b64\u5e8f\u5217\u4e2d\u3002 StringBufferinsert(int offset, float f)
\u5c06 float \u53c2\u6570\u7684\u5b57\u7b26\u4e32\u8868\u793a\u5f62\u5f0f\u63d2\u5165\u6b64\u5e8f\u5217\u4e2d\u3002 StringBufferinsert(int offset, int i)
\u5c06 int \u53c2\u6570\u7684\u5b57\u7b26\u4e32\u8868\u793a\u5f62\u5f0f\u63d2\u5165\u6b64\u5e8f\u5217\u4e2d\u3002 StringBufferinsert(int offset, long l)
\u5c06 long \u53c2\u6570\u7684\u5b57\u7b26\u4e32\u8868\u793a\u5f62\u5f0f\u63d2\u5165\u6b64\u5e8f\u5217\u4e2d\u3002 StringBufferinsert(int offset, Object obj)
\u5c06 Object \u53c2\u6570\u7684\u5b57\u7b26\u4e32\u8868\u793a\u5f62\u5f0f\u63d2\u5165\u6b64\u5b57\u7b26\u5e8f\u5217\u4e2d\u3002 StringBufferinsert(int offset, String str)
\u5c06\u5b57\u7b26\u4e32\u63d2\u5165\u6b64\u5b57\u7b26\u5e8f\u5217\u4e2d\u3002 intlastIndexOf(String str)
\u8fd4\u56de\u6700\u53f3\u8fb9\u51fa\u73b0\u7684\u6307\u5b9a\u5b50\u5b57\u7b26\u4e32\u5728\u6b64\u5b57\u7b26\u4e32\u4e2d\u7684\u7d22\u5f15\u3002 intlastIndexOf(String str, int fromIndex)
\u8fd4\u56de\u6700\u540e\u4e00\u6b21\u51fa\u73b0\u7684\u6307\u5b9a\u5b50\u5b57\u7b26\u4e32\u5728\u6b64\u5b57\u7b26\u4e32\u4e2d\u7684\u7d22\u5f15\u3002 intlength()
\u8fd4\u56de\u957f\u5ea6\uff08\u5b57\u7b26\u6570\uff09\u3002 intoffsetByCodePoints(int index, int codePointOffset)
\u8fd4\u56de\u6b64\u5e8f\u5217\u4e2d\u7684\u4e00\u4e2a\u7d22\u5f15\uff0c\u8be5\u7d22\u5f15\u662f\u4ece\u7ed9\u5b9a index \u504f\u79fb codePointOffset \u4e2a\u4ee3\u7801\u70b9\u540e\u5f97\u5230\u7684\u3002 StringBufferreplace(int start, int end, String str)
\u4f7f\u7528\u7ed9\u5b9a String \u4e2d\u7684\u5b57\u7b26\u66ff\u6362\u6b64\u5e8f\u5217\u7684\u5b50\u5b57\u7b26\u4e32\u4e2d\u7684\u5b57\u7b26\u3002 StringBufferreverse()
\u5c06\u6b64\u5b57\u7b26\u5e8f\u5217\u7528\u5176\u53cd\u8f6c\u5f62\u5f0f\u53d6\u4ee3\u3002 voidsetCharAt(int index, char ch)
\u5c06\u7ed9\u5b9a\u7d22\u5f15\u5904\u7684\u5b57\u7b26\u8bbe\u7f6e\u4e3a ch\u3002 voidsetLength(int newLength)
\u8bbe\u7f6e\u5b57\u7b26\u5e8f\u5217\u7684\u957f\u5ea6\u3002 CharSequencesubSequence(int start, int end)
\u8fd4\u56de\u4e00\u4e2a\u65b0\u7684\u5b57\u7b26\u5e8f\u5217\uff0c\u8be5\u5b57\u7b26\u5e8f\u5217\u662f\u6b64\u5e8f\u5217\u7684\u5b50\u5e8f\u5217\u3002 Stringsubstring(int start)
\u8fd4\u56de\u4e00\u4e2a\u65b0\u7684 String\uff0c\u5b83\u5305\u542b\u6b64\u5b57\u7b26\u5e8f\u5217\u5f53\u524d\u6240\u5305\u542b\u7684\u5b57\u7b26\u5b50\u5e8f\u5217\u3002 Stringsubstring(int start, int end)
\u8fd4\u56de\u4e00\u4e2a\u65b0\u7684 String\uff0c\u5b83\u5305\u542b\u6b64\u5e8f\u5217\u5f53\u524d\u6240\u5305\u542b\u7684\u5b57\u7b26\u5b50\u5e8f\u5217\u3002 StringtoString()
\u8fd4\u56de\u6b64\u5e8f\u5217\u4e2d\u6570\u636e\u7684\u5b57\u7b26\u4e32\u8868\u793a\u5f62\u5f0f\u3002 voidtrimToSize()
\u5c1d\u8bd5\u51cf\u5c11\u7528\u4e8e\u5b57\u7b26\u5e8f\u5217\u7684\u5b58\u50a8\u7a7a\u95f4\u3002

构造方法摘要 
StringBuffer() 
          构造一个其中不带字符的字符串缓冲区,其初始容量为 16 个字符。 
StringBuffer(int capacity) 
          构造一个不带字符,但具有指定初始容量的字符串缓冲区。 
StringBuffer(String str) 
          构造一个字符串缓冲区,并将其内容初始化为指定的字符串内容。 
 
方法摘要 
 StringBuffer append(boolean b) 
          将 boolean 参数的字符串表示形式追加到序列。 
 StringBuffer append(char c) 
          将 char 参数的字符串表示形式追加到此序列。 
 StringBuffer append(char[] str) 
          将 char 数组参数的字符串表示形式追加到此序列。 
 StringBuffer append(char[] str, int offset, int len) 
          将 char 数组参数的子数组的字符串表示形式追加到此序列。 
 StringBuffer append(double d) 
          将 double 参数的字符串表示形式追加到此序列。 
 StringBuffer append(float f) 
          将 float 参数的字符串表示形式追加到此序列。 
 StringBuffer append(int i) 
          将 int 参数的字符串表示形式追加到此序列。 
 StringBuffer append(long lng) 
          将 long 参数的字符串表示形式追加到此序列。 
 StringBuffer append(Object obj) 
          追加 Object 参数的字符串表示形式。 
 StringBuffer append(String str) 
          将指定的字符串追加到此字符序列。 
 StringBuffer append(StringBuffer sb) 
          将指定的 StringBuffer 追加到此序列中。 
 StringBuffer appendCodePoint(int codePoint) 
          将 codePoint 参数的字符串表示形式追加到此序列。 
 int capacity() 
          返回当前容量。 
 char charAt(int index) 
          返回此序列中指定索引处的 char 值。 
 int codePointAt(int index) 
          返回指定索引处的字符(统一代码点)。 
 int codePointBefore(int index) 
          返回指定索引前的字符(统一代码点)。 
 int codePointCount(int beginIndex, int endIndex) 
          返回此序列指定文本范围内的统一代码点。 
 StringBuffer delete(int start, int end) 
          移除此序列的子字符串中的字符。 
 StringBuffer deleteCharAt(int index) 
          移除此序列指定位置的 char。 
 void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin) 
          将字符从此序列复制到目标字符数组 dst。 
 int indexOf(String str) 
          返回第一次出现的指定子字符串在该字符串中的索引。 
 int indexOf(String str, int fromIndex) 
          从指定的索引处开始,返回第一次出现的指定子字符串在该字符串中的索引。 
 StringBuffer insert(int offset, boolean b) 
          将 boolean 参数的字符串表示形式插入此序列中。 
 StringBuffer insert(int offset, char c) 
          将 char 参数的字符串表示形式插入此序列中。 
 StringBuffer insert(int offset, char[] str) 
          将 char 数组参数的字符串表示形式插入此序列中。 
 StringBuffer insert(int index, char[] str, int offset, int len) 
          将数组参数 str 的子数组的字符串表示形式插入此序列中。 
 StringBuffer insert(int dstOffset, CharSequence s, int start, int end) 
          将指定 CharSequence 的子序列插入此序列中。 
 StringBuffer insert(int offset, double d) 
          将 double 参数的字符串表示形式插入此序列中。 
 StringBuffer insert(int offset, float f) 
          将 float 参数的字符串表示形式插入此序列中。 
 StringBuffer insert(int offset, int i) 
          将 int 参数的字符串表示形式插入此序列中。 
 StringBuffer insert(int offset, long l) 
          将 long 参数的字符串表示形式插入此序列中。 
 StringBuffer insert(int offset, Object obj) 
          将 Object 参数的字符串表示形式插入此字符序列中。 
 StringBuffer insert(int offset, String str) 
          将字符串插入此字符序列中。 
 int lastIndexOf(String str) 
          返回最右边出现的指定子字符串在此字符串中的索引。 
 int length() 
          返回长度(字符数)。  
 StringBuffer replace(int start, int end, String str) 
          使用给定 String 中的字符替换此序列的子字符串中的字符。 
 StringBuffer reverse() 
          将此字符序列用其反转形式取代。 
 void setCharAt(int index, char ch) 
          将给定索引处的字符设置为 ch。 
 void setLength(int newLength) 
          设置字符序列的长度。 
 String substring(int start) 
          返回一个新的 String,它包含此字符序列当前所包含的字符子序列。 
 String substring(int start, int end) 
          返回一个新的 String,它包含此序列当前所包含的字符子序列。 
 String toString() 
          返回此序列中数据的字符串表示形式。


StringBuffer sb = new StringBuffer("Hello ");
sb.append("world");   //在sb尾部追加一个字符串, 此时变成 Hello world;
sb.charAt(1) ;  //返回下标为1的字符 此处是 e
sb.insert(1,"d");  //在 1 处插入新的字符串 d  此时变为 Hedllo world;
sb.reverse();  //反转字符 此时变成    dlrow olldeH
sb.delete(1,2);  //删除字符串  此时变为Hllo world
sb.replace(3,4,"new");  //替换字符串  从 3开始到4结束  此时变为  Hllnewworld

全是手打的,望采纳



  • C++鍜java鍦string鏁版嵁绫诲瀷鐨瀛樺偍鍜屽肩殑鍙樺寲涓婃湁浠涔堝尯鍒,鍐呭瓨鎿嶄綔鐨勬満 ...
    绛旓細C++ string 鍩烘湰绛変簬 Java StringBuff C++ const string 鍩烘湰绛変簬Java String 涔熷氨鏄C++string鍙彉鑰javaString涓嶅彲鍙 O1=O2;鍦–++涓皢涓涓悕涓篛2鐨勫璞$殑鏁版嵁澶嶅埗缁橭1,鍗冲瓨鍦ㄤ袱涓璞★紝浠栦滑鐨勫肩浉鍚屻傝屽湪Java涓锛岃繖鍙ヨ瘽鍙槸鎶奜2瀵硅薄鐨勫紩鐢ㄥ鍒剁粰浜哋1锛屾鏃跺畠浠寚鍚戝悓涓涓璞★紝鍗冲彧瀛樺湪涓涓璞...
  • C++鐨剆tring 鍜Java鐨凷tring鏈変粈涔堝尯鍒?
    绛旓細C++鐨剆tring 鍜Java鐨凷tring鍖哄埆濡備笅锛1锛屾彁鍙栧瓙涓 String绫绘彁鍙栧瓙涓茬殑鏂规硶鏄痵ubstring鏂规硶锛屼緥濡傦細String str = "hello"; String substr = str.subdtring(0,4);锛屽湪杩欓噷锛岀涓涓弬鏁版槸璧峰浣嶇疆锛岀浜屼釜鍙傛暟鏄笉鎯冲鍒剁殑绗竴涓綅缃垨鑰呰鏄埅姝綅缃傜粨鏋滃氨鏄"hel"銆2锛屽瓧绗︿覆鎷兼帴 java璇█涓嶤++...
  • JAVA瀵瑰瓧绗︿覆鐨勫彉鎹㈠拰澶嶅師鎿嶄綔
    绛旓細public static String encode(String str) { StringBuffer buff = new StringBuffer();char[] arr = str.toCharArray();for (int i = 0; i < arr.length; i++) { if (i != 0)buff.append("_");if (arr[i] > 48 && arr[i] <= 57) { if (i < arr.length - 1) { for...
  • java涓鐢∕D5缂栧啓鐨勫瘑鐮佷繚鎶?
    绛旓細public static String bytesToMD5(byte[] input) { String md5str = null;try { //鍒涘缓涓涓彁渚涗俊鎭憳瑕佺畻娉鐨瀵硅薄锛屽垵濮嬪寲涓簃d5绠楁硶瀵硅薄 MessageDigest md = MessageDigest.getInstance("MD5");//璁$畻鍚庤幏寰楀瓧鑺傛暟缁 byte[] buff = md.digest(input);//鎶婃暟缁勬瘡涓瀛楄妭鎹㈡垚16杩涘埗杩炴垚md5瀛楃涓 md...
  • java,闄や簡瀛楃涓插墠瀵肩殑*鍙蜂箣澶,灏嗕覆涓叾浠*鍙峰叏閮ㄥ垹闄
    绛旓細1.姝e垯琛ㄨ揪寮 2.灏嗗瓧绗︿覆杞崲涓StringBuffer锛屽惊鐜垽鏂紝涓嶆弧瓒鐨璋冪敤delete锛堬級鏂规硶鍒犻櫎 3.灏哠tringBuffter瀵硅薄.toString()鍐嶆崲鍥炴潵涓篠tring绫诲瀷
  • java涓璇诲叆鍜岃緭鍑烘枃鏈枃浠
    绛旓細鍐欐枃浠 import java.io.File;import java.io.FileNotFoundException;import java.io.FileOutputStream;import java.io.IOException;import java.io.OutputStreamWriter;import java.io.UnsupportedEncodingException;import java.io.Writer;public class WriteFile { public static void main(String[] args)...
  • java涓鏈変竴涓猰ap绫诲瀷鏁扮粍,鎴戠幇鍦ㄦ兂鎶婂畠杞崲鎴愬瓧绗︿覆褰㈠紡,骞朵笖鎶婂師鏉ョ殑...
    绛旓細鐩存帴map.toString()灏眘tring鏍煎紡鍟 瑕佷笉灏 StringBuffer sb =new StringBuff();foreach(Map.Entity<String,String> en in map.getEntitySet()) { //鍙栧嚭key value 鎷兼帴瀛楃涓 sb.append(en.getkey()).apend(",").append(en.getValue()).append(",");} 绾墜鎵 鐪熷績鍐峰晩 鍔犵彮鐨浜轰激涓嶈捣...
  • java 鐧婚檰鏃剁殑楠岃瘉鐮佹庝箞鍋?
    绛旓細楠岃瘉鐮佹槸鍦ㄧ敤鎴风櫥褰曢〉闈笂鍔犲叆涓寮犻殢鏈虹敓鎴鐨鍥剧墖锛岃鐢ㄦ埛杈撳叆鍥剧墖涓墍鏄剧ず鐨勫瓧绗︽垨鏁板瓧锛屼互姝ゆ潵楠岃瘉鐢ㄦ埛鏄惁涓轰汉绫昏涓猴紝鏈夋晥闃叉鏈哄櫒浜烘垨鑰呮伓鎰忚蒋浠舵敾鍑汇Java瀹炵幇楠岃瘉鐮佺殑鍏蜂綋姝ラ濡備笅锛1. 鐢熸垚闅忔満瀛楃涓诧細鍙互浣跨敤Random绫绘潵闅忔満鐢熸垚瀛楃涓诧紝涔熷彲浠ヤ娇鐢║UID绛夊伐鍏枫2. 鎶婄敓鎴愮殑闅忔満瀛楃涓叉斁鍦ㄥ浘鐗囦笂锛...
  • 缂栧啓JAVA绋嬪簭灏嗗瓧绗tr="2,3,4,5,6,7,8,9,11,13,14,"鍙樹负鈥2-9,11,1...
    绛旓細缂栧啓java绋嬪簭灏嗗瓧绗︿覆str="2,3,4,5,6,7,8,9,11,13,14" 鍙樹负"2-9,11,13-14"public static void cutString(){ String str = "2,3,4,5,6,7,8,9,11,13,14";String[] str1 = str.split(",");StringBuffer buff = new StringBuffer() ;int c1,c2 ;int i,j;boolean is...
  • 鐢java鎬庝箞鍒朵綔楠岃瘉鐮
    绛旓細stringbuffer.append(str1);} //灏嗙敓鎴愮殑楠岃瘉鐮佸瓨鍒版湇鍔″櫒 request.getSession().setAttribute("checkcode", stringbuffer.toString());//key鍜寁alue //灏嗗浘鐗囧彂閫佺粰娴忚鍣 ImageIO.write(image, "jpg", response.getOutputStream());} } 鐢ㄦ埛鐧诲綍鐣岄潰浠g爜 package s1;import java.io.IOException;...
  • 扩展阅读:www.sony.com.cn ... java blockingqueue ... java javascript ... minecraft国际版java版 ... java windowbuilder ... java中scanner用法 ... public static void main ... java官网官网 ... 手机版java启动器下载 ...

    本站交流只代表网友个人观点,与本站立场无关
    欢迎反馈与建议,请联系电邮
    2024© 车视网