Class StringBuilder

Java class StringBuilder is used to build up a string. Here are some of the things that you can do with it.

new StringBuilder()

Expression new StringBuilder yields a new StringBuilder object initially holding an empty string.

b.append(x)

If b is a StringBuilder object, then b.append(x) adds x to the end of the string in b, where x is a string or a character or a variety of different types that can be converted to strings, such as an integer or real number.

b.length()

Expression b.length() yields the length of the string in StringBuilder object b.

b.toString()

Expression b.toString() yields the string currently held in StringBuilder object b.