In Stringbuffer class you can use functions like append, insert, reverse, setCharAt, charAt, length, deleteCharAt, substring, delete, capacityetc. to manipulate the string operation in your program.
The
StringBuffer class is used to represent characters that can be modified. This is simply used for concatenation or manipulation of the strings.
StringBuffer is mainly used for the dynamic string concatenation which enhances the performance. A string buffer implements a mutable sequence of characters. A string buffer is like a
String, but can be modified. At any point in time it contains some particular sequence of characters, but the length and content of the sequence can be changed through certain method calls. There are some functions used in the given example. All the functions have been explained below with example :This is the append() function used for the concatenate the string in string buffer. This is better to use for dynamic string concatenation. This function works like a simple string concatenation such as : String str = str + "added string";.
insert()
This is the insert() function used to insert any string or character at the specified position in the given string.
reverse()
This is the reverse() function used to reverse the string present in string buffer.
setCharAt()
This is the setCharAt() function which is used to set the specified character in buffered string at the specified position of the string in which you have to set the given character.
charAt()
This is the charAt() function which is used to get the character at the specified position of the given string.







Run website on Offline mode Using UpUp Javascript Framework
ReplyDeleteAngularJS LazyTube directive
Scan Uploaded File using VirusTotal Java Library
Get Data From Database Using AngularJS in JSP
PrimeFaces vs RichFaces vs IceFaces in JSF
PDF Reader Android SDK
Diference - JavaFx vs Swing