Home All Groups Group Topic Archive Search About

Simple: how to add speaces to a string

Author
17 Feb 2006 3:28 PM
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

Author
17 Feb 2006 3:32 PM
AMDRIT
Take a look at PadLeft, PadRight

example:

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





Show quoteHide quote
"Joe" <J**@discussions.microsoft.com> wrote in message
news:89580253-C2CA-4E57-926A-BB538A5F586B@microsoft.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
Author
17 Feb 2006 3:50 PM
Joe
Thanks.
--
Joe


Show quoteHide quote
"AMDRIT" wrote:

> Take a look at PadLeft, PadRight
>
> example:
>
> dim x as string
> x = "test"
> x.padleft(15," ")
>
>
>
>
>
> "Joe" <J**@discussions.microsoft.com> wrote in message
> news:89580253-C2CA-4E57-926A-BB538A5F586B@microsoft.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
>
>
>