How space function in C#

  • Thread starter Thread starter ad
  • Start date Start date
A

ad

Is there fucntion in C#, which will return a string consist of a given
number of space, like

Space(5)-> " ";
 
Mark R. Dawson said:
string strPadded = "".PadRight(5);

That will work, but I personally far prefer Jon Shemitz's solution -
it's more readable, and it's very obvious how to go from that to a
string of 5 tabs, say.
 
That will work, but I personally far prefer Jon Shemitz's solution -
it's more readable, and it's very obvious how to go from that to a
string of 5 tabs, say.

Well, you still can do the same with padding:

"".PadRight( 5, '\t' );

But as of preference, I still agree with you :))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top