StringBuilder class Methods in Java Part - I

java.lang.StringBuilder

A mutable sequence of characters. This class provides an API compatible with StringBuffer, but with no guarantee of synchronization. This class is designed for use as a drop-in replacement for StringBuffer in places where the string buffer was being used by a single thread (as is generally the case). Where possible, it is recommended that this class be used in preference to StringBuffer as it will be faster under most implementations.


Some methods of StringBuilder class


appendCodePoint()It appends the string representation of the codePoint argument to this sequence.


append(): It appends the string representation of the Object argument.


append(char[] str, int offset, int len)It appends the string representation of a subarray of the char array argument to this sequence.


append(CharSequence s, int start, int end)It appends a subsequence of the specified CharSequence to this sequence.


capacity(): It returns the current capacity.


charAt()It returns the char value in this sequence at the specified index.


codePointAt() It returns the character (Unicode code point) at the specified index.


codePointBefore() It returns the character (Unicode code point) before the specified index.


codePointCount()It returns the number of Unicode code points in the specified text range of this sequence.


compareTo()It compares two StringBuilder instances lexicographically.


delete()It removes the characters in a substring of this sequence. 


deleteCharAt() It removes the char at the specified position in this sequence. 


ensureCapacity() It ensures that the capacity is at least equal to the specified minimum.


equals(): It indicates whether some other object is "equal to" this one.


getChars()Characters are copied from this sequence into the destination character array dst. 


indexOf(String str)It returns the index within this string of the first occurrence of the specified substring.


Some more Methods of StringBuilder class



No comments:

Post a Comment