StringBuilder Class Methods List
Here is a complete list of methods available in the StringBuilder class in Java:
- append(boolean b)
- append(char c)
- append(char[] str)
- append(char[] str, int offset, int len)
- append(double d)
- append(float f)
- append(int i)
- append(long lng)
- append(Object obj)
- append(String str)
- capacity()
- charAt(int index)
- codePointAt(int index)
- codePointBefore(int index)
- codePointCount(int beginIndex, int endIndex)
- delete(int start, int end)
- deleteCharAt(int index)
- ensureCapacity(int minimumCapacity)
- getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)
- indexOf(String str)
- indexOf(String str, int fromIndex)
- insert(int offset, boolean b)
- insert(int offset, char c)
- insert(int offset, char[] str)
- insert(int offset, char[] str, int strOffset, int strLen)
- insert(int offset, double d)
- insert(int offset, float f)
- insert(int offset, int i)
- insert(int offset, long l)
- insert(int offset, Object obj)
- insert(int offset, String str)
- lastIndexOf(String str)
- lastIndexOf(String str, int fromIndex)
- length()
- offsetByCodePoints(int index, int codePointOffset)
- replace(int start, int end, String str)
- reverse()
- setCharAt(int index, char ch)
- setLength(int newLength)
- substring(int start)
- substring(int start, int end)
- toString()
- trimToSize()
These methods can be used to perform various operations on string builders, such as appending or inserting new characters, deleting characters, finding and replacing substrings, and many others. Some methods are used to manipulate the builder's length and capacity, while others are used to obtain information about the contents of the builder, such as its length or the value of a particular character at a given index.