By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,703 Members | 1,400 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,703 IT Pros & Developers. It's quick & easy.

Simple: how to add speaces to a string

P: n/a
Joe
Hello All:

I have a simple question: how do I concatenate spaces to a string? Say I
have "John Doe" as my string and I want "John Doe " with 15
spaces following his name. How do I do this?

In old VB6, I would use the Space function. What is available in .NET?. I
am trying to avoid using carry over functions, since I want to learn the
framework as well as possible.

TIA,
--
Joe
Feb 17 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Take a look at PadLeft, PadRight

example:

dim x as string
x = "test"
x.padleft(15," ")

"Joe" <Jo*@discussions.microsoft.com> wrote in message
news:89**********************************@microsof t.com...
Hello All:

I have a simple question: how do I concatenate spaces to a string? Say I
have "John Doe" as my string and I want "John Doe " with 15
spaces following his name. How do I do this?

In old VB6, I would use the Space function. What is available in .NET?.
I
am trying to avoid using carry over functions, since I want to learn the
framework as well as possible.

TIA,
--
Joe

Feb 17 '06 #2

P: n/a
Joe
Thanks.
--
Joe
"AMDRIT" wrote:
Take a look at PadLeft, PadRight

example:

dim x as string
x = "test"
x.padleft(15," ")

"Joe" <Jo*@discussions.microsoft.com> wrote in message
news:89**********************************@microsof t.com...
Hello All:

I have a simple question: how do I concatenate spaces to a string? Say I
have "John Doe" as my string and I want "John Doe " with 15
spaces following his name. How do I do this?

In old VB6, I would use the Space function. What is available in .NET?.
I
am trying to avoid using carry over functions, since I want to learn the
framework as well as possible.

TIA,
--
Joe


Feb 17 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.