DEV Community

Cover image for 3.Stringbuilder class in java
Souravsing Pardeshi
Souravsing Pardeshi

Posted on • Updated on

3.Stringbuilder class in java

Java Stringbuilder class

  • Strings in java are immutable (not editable)

  • so to make changes in string we use this string builder class which makes the string mutable (editable)

  • there are different methods which comes with stringbuilder class as shown below
    Image Stringbuilder class in java

1.Append:

  • This method will simply append an string to existing string.

2.Insert:

  • this will insert an character or strig at given position in given string.

3.Replace:

  • this will replace certain part of string with another string.

  • it take position of string which need to be replaced.

4.Delete:

  • this method will delete certain part of string by taking starting and ending position.

Top comments (2)

Collapse
 
dukemagus profile image
Duke

typo on the title

Collapse
 
souravsingpardeshi profile image
Souravsing Pardeshi

thanks, updated🙂