How to add SPACES to a string variable
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Raunak JhawarPosted Dec 30, 2009, 9:23 AM
Raunak JhawarPosted Dec 30, 2009, 9:23 AM
paul danielPosted Dec 30, 2009, 9:01 AM
see this eg:
string s1 = "VM";
s1 = s1 + " ";
~ or ~
string s1 = "VM";
string s2 = s1 + " ";
Hiren SoniPosted Dec 21, 2009, 6:55 AM
Nilanka DharmadasaPosted Dec 21, 2009, 3:39 AM
There is no special method to do that.
You can simply add a space.
string a = " ";
string b = "abc" + a + "xyz";
Or you can use PadLeft, PadRight functions.
If you want to add a tab then you can do the following.
string a = "\t";
string b = "abc" + a + "xyz";
If this is helpful to you, please check 'Do you like this answer' checkbox.