StringBuilder sb = new StringBuilder(); sb.append("World"); sb.insert(0, "Hello "); // <----- prepending
Programming Tips - Java: How can I prepend (add at the start) of a StringBuilder?
Date: 2012dec20
Language: Java
Keywords: append
Q. Java: How can I prepend (add at the start) of a StringBuilder?
A. Use insert with position zero: