Java StringBuilder delete() method is used to delete a portion of the string. A StringBuilder instance represents a character sequence. We can delete a portion… [Read More]
Java StringBuilder trimToSize()
Java StringBuilder trimToSize() method is used to reduce the capacity of StringBuilder instance, if possible. This method checks for non-utilized allocated space, it frees up… [Read More]
Java StringBuilder lastIndexOf()
In this tutorial, we will discuss the Java StringBuilder lastIndexOf() method with the help of example programs. The syntax of lastIndexOf() method is: //Returns the… [Read More]
Java StringBuilder indexOf()
In this guide, we will discuss the Java StringBuilder indexOf() method with the help of examples. The syntax of indexOf() method is: sb.indexOf(“hello”); //searches string… [Read More]
Java StringBuilder ensureCapacity()
In this tutorial, we will discuss the Java StringBuilder ensureCapacity() method with the help of examples. This method ensures that a minimum capacity is maintained…. [Read More]
Java StringBuilder substring()
In this tutorial, we will discuss the Java StringBuilder substring() method with the help of examples. The syntax of substring() method is: sb.substring(4) //substring starting… [Read More]
Java StringBuilder Class With Examples
StringBuilder in Java is used to create mutable strings. A mutable string is the one which can be modified instead of creating new string instance…. [Read More]
Java StringBuilder charAt()
In this tutorial, we will discuss the Java StringBuilder charAt() method with the help of examples. The syntax of charAt() method is: sb.charAt() Here, sb… [Read More]
Java StringBuilder capacity() Method
Java StringBuilder capacity() method returns the current capacity of StringBuilder object. In this tutorial, we will discuss the capacity() method in detail with the help… [Read More]
Java StringBuilder append() Method
The append() method of Java StringBuilder class is used to append a specified value at the end of this character sequence. Syntax of append() Method:… [Read More]
StringBuilder append() null values as “null” String
While working with StringBuilder you may have come across a strange behaviour of append() method for null values. If you append a null value to… [Read More]
How to append a newline to StringBuilder
There are following two ways to append a new Line to a StringBuilder object:1) StringBuilder.append(“\n”);2) StringBuilder.append(System.getProperty(“line.separator”)); Example In this example we have a StringBuilder object… [Read More]