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
Well, for a start, chr(9) is a tab character – you would want to use chr(32) to get a space.
That said, the first option,
string.Concat('a',' ','b'), is a more readable one. I would be concentrating on getting your code functionally correct to start with. Optimization should always be a last step and targeted only to those areas that need it. In other words, you need a baseline to check your optimizations against.Far too many times, you optimize then find yourself having to change the code anyway, meaning that your optimization effort was wasted.