How to remove all characters from StringBuilder in C#
StringBuilder.Clear Method is used to remove all the characters from the current StringBuilder instance.
public System.Text.StringBuilder Clear ();
It returns an StringBuilder object whose length will be zero.
- Clear is a convenience method that is equivalent to setting the Length property of the current instance to 0 (zero).
- Calling the Clear method does not modify the current instance’s Capacity or MaxCapacity property.
The String is: GeeksforGeeks Total characters -- 13 The String is: Total characters -- 0 The String is: This is C# Tutorials. Total characters -- 22