How do I append white space to a string builder? I need to insert 90 blank spaces, in VB
i had this code but i was confused how to write in c#
can any one help me
Dim S As New StringBuilder("HELLO")
S.Append(" "c, 90)
S.Append("WORLD")
MessageBox.Show(S.ToString)
Thanks.
append(char a): This is an inbuilt method in Java which is used to append the string representation of the char argument to the given sequence. The char argument is appended to the contents of this StringBuilder sequence.
If you are using two or three string concatenations, use a string. StringBuilder will improve performance in cases where you make repeated modifications to a string or concatenate many strings together. In short, use StringBuilder only for a large number of concatenations.
Converting a String to StringBuilderThe append() method of the StringBuilder class accepts a String value and adds it to the current object. To convert a String value to StringBuilder object just append it using the append() method.
S.Append(' ', 90);
that ought to do it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With