Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding spaces between strings

What's the best way of adding spaces between strings

myString = string.Concat("a"," ","b")

or

myString = string.Concat("a",Chr(9),"b")

I am using stringbuilder to build an XML file and looking for something efficient.

Thanks

Edit ~ Language VB.NET

like image 712
Saif Khan Avatar asked Jul 21 '26 15:07

Saif Khan


2 Answers

Create your XML file with the XmlDocument class. Your wasting your time creating a string from scratch.

like image 80
Razor Avatar answered Jul 24 '26 10:07

Razor


String.Join is a static method that can take the separator (in this case, " ") and an array of strings.

string sentence = String.Join(" ", new string[] { "The", "quick", "brown", "fox" });
like image 24
defeated Avatar answered Jul 24 '26 11:07

defeated



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!