You are on page 1of 4

String Buffer Methods StringBuffer append(boolean b) Appends the string representation of the boolean argument to the string buffer.

append(char c) Appends the string representation of the char argument to this string buffer. append(char[] str) Appends the string representation of the char array argument to this string buffer. append(char[] str, int offset, int len) Appends the string representation of a subarray of the char array argument to this string buffer. append(double d) Appends the string representation of the double argument to this string buffer. append(float f) Appends the string representation of the float argument to this string buffer. append(int i) Appends the string representation of the int argument to this string buffer. append(long l) Appends the string representation of the long argument to this string buffer. append(Ob ect ob ) Appends the string representation of the Ob ect argument to this string buffer. append(String str) Appends the string to this string buffer. append(StringBuffer sb) Appends the specified StringBuffer to this StringBuffer.

StringBuffer

StringBuffer

StringBuffer

StringBuffer

StringBuffer

StringBuffer

StringBuffer

StringBuffer

StringBuffer

StringBuffer

int

capacity() !eturns the current capacity of the String buffer. charAt(int inde") #he specified character of the se$uence currently represented by the string buffer, as indicated by the inde" argument, is returned. delete(int start, int end) !emo%es the characters in a substring of this StringBuffer. deleteCharAt(int inde") !emo%es the character at the specified position in this StringBuffer (shortening the StringBuffer by one character). ensureCapacity(int minimum&apacity) 'nsures that the capacity of the buffer is at least e$ual to the specified minimum. getChars(int srcBegin, int src'nd, char[] dst, int dstBegin) &haracters are copied from this string buffer into the destination character array dst. indexOf(String str) !eturns the inde" (ithin this string of the first occurrence of the specified substring. indexOf(String str, int from)nde") !eturns the inde" (ithin this string of the first occurrence of the specified substring, starting at the specified inde". insert(int offset, boolean b) )nserts the string representation of the boolean argument into this string buffer. insert(int offset, char c) )nserts the string representation of the char argument into this string buffer. insert(int offset, char[] str) )nserts the string representation of the char array argument into this string buffer. insert(int inde", char[] str, int offset, int len)

char

StringBuffer

StringBuffer

%oid

%oid

int

int

StringBuffer

StringBuffer

StringBuffer

StringBuffer

)nserts the string representation of a subarray of the str array argument into this string buffer. StringBuffer insert(int offset, double d) )nserts the string representation of the double argument into this string buffer. insert(int offset, float f) )nserts the string representation of the float argument into this string buffer. insert(int offset, int i) )nserts the string representation of the second int argument into this string buffer. insert(int offset, long l) )nserts the string representation of the long argument into this string buffer. insert(int offset, Ob ect ob ) )nserts the string representation of the Ob ect argument into this string buffer. insert(int offset, String str) )nserts the string into this string buffer. lastIndexOf(String str) !eturns the inde" (ithin this string of the rightmost occurrence of the specified substring. lastIndexOf(String str, int from)nde") !eturns the inde" (ithin this string of the last occurrence of the specified substring. length() !eturns the length (character count) of this string buffer. replace(int start, int end, String str) !eplaces the characters in a substring of this StringBuffer (ith characters in the specified String. reverse() #he character se$uence contained in this string buffer is

StringBuffer

StringBuffer

StringBuffer

StringBuffer

StringBuffer

int

int

int

StringBuffer

StringBuffer

replaced by the re%erse of the se$uence. %oid setCharAt(int inde", char ch) #he character at the specified inde" of this string buffer is set to ch. setLength(int ne(*ength) Sets the length of this String buffer.

%oid

&harSe$uence subSequence(int start, int end) !eturns a ne( character se$uence that is a subse$uence of this se$uence. String substring(int start) !eturns a ne( String that contains a subse$uence of characters currently contained in this StringBuffer.#he substring begins at the specified inde" and e"tends to the end of the StringBuffer. substring(int start, int end) !eturns a ne( String that contains a subse$uence of characters currently contained in this StringBuffer. toString() &on%erts to a string representing the data in this string buffer.

String

String

You might also like