Spacing

N

Nicholas Paldino [.NET/C# MVP]

John,

You can use the constructor for the string, like this:

// Create a string with 10 spaces
string pstrString = new string(' ', 10);

Hope this helps.
 
E

Ed Courtenay

john said:
Is there a Space function in C# like there is in Visual Basic?


You can use one of the overloaded constructors for string to emulate it:

string spaceString = new string(' ', 10);

Also, have a look at the String.PadLeft() and String.PadRight() methods.
 
J

james

.... and do a search of the newsgroup first to see if the question was
already asked and answered
 

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

Top