StringBuilder.insert(int offset, String str) has the following syntax.
public StringBuilder insert(int offset, String str)
In the following code shows how to use StringBuilder.insert(int offset, String str) method.
// www .j a va 2s. 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.