Java StringBuilder.insert(int offset, String str)
Syntax
StringBuilder.insert(int offset, String str) has the following syntax.
public StringBuilder insert(int offset, String str)
Example
In the following code shows how to use StringBuilder.insert(int offset, String str) method.
//w w w . j a v a 2 s .c o m
public class Main {
public static void main(String args[]) {
StringBuilder buffer = new StringBuilder();
String string = "java2s.com";
buffer.insert(0, string);
System.out.println(buffer.toString());
}
}
The code above generates the following result.