StringBuilder Methods
append, insert, reverse, delete.
More Than append
Beyond append, StringBuilder offers many methods to modify text in place: insert, delete, reverse, replace, and more. Let us explore the most useful ones.
insert
insert(index, value) places content at a specific position, shifting the rest to the right.
public class Main {
public static void main(String[] args) {
StringBuilder sb = new StringBuilder("Hello World");
sb.insert(5, ",");
System.out.println(sb);
}
}