Spaces function

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi

Is there a spaces(n) function equivalent in vb.net that returns a string of
spaces of length n?

Thanks

Regards
 
Hi John,

S = New String(" "c, 20)

Note the little 'c' which denotes a character as opposed to a string.

Regards,
Fergus

ps. I'm betting this is one of, oh, 5 replies.
 
Hi John,

S = New String(" "c, 20)

Note the little 'c' which denotes a character as opposed to a string.

Regards,
Fergus

ps. I'm betting this is one of, oh, 5 replies.

One
 
Hi Tom,

Yep, just the one! :-( I bet on the wrong horse - it was the 'vb.net
equivalent' that got the crowd gathering. But maybe there will be some
redundant additions in the morning, eh? Lol. Maybe you could add your version
of creating spaces just to cheer me up! ;-))

Regards,
Fergus
 
* "John said:
Is there a spaces(n) function equivalent in vb.net that returns a string of
spaces of length n?

\\\
Dim s As String = New String(" "c, 60)
///
 
Well, you can use the PadLeft and PadRight methods that
string variables have in .Net. For example:

Dim str As String
str.PadLeft(10)

effectively creates a string of 10 spaces.
 
Back
Top