Home All Groups Group Topic Archive Search About

Padding blank space using PadRight

Author
16 Jun 2006 9:04 PM
Bill Nguyen
I tried in vain to add blank space to the end of couple variables as below:

mPadding = Convert.ToChar(" ")

mdriverBegin.PadRight(16, mPadding)

mdriverEnd.PadRight(16, mPadding)

mSitekey.PadRight(4, mPadding)

What should I use to get a blank space?



Thanks

Bill

Author
16 Jun 2006 9:13 PM
Chris Dunaway
PadRight does not change the string, it returns a new string that has
been padded so you need a line like this:

mdriverBegin = mdriverBegin.PadRight(16, mPadding)


Bill Nguyen wrote:
Show quoteHide quote
> I tried in vain to add blank space to the end of couple variables as below:
>
> mPadding = Convert.ToChar(" ")
>
> mdriverBegin.PadRight(16, mPadding)
>
> mdriverEnd.PadRight(16, mPadding)
>
> mSitekey.PadRight(4, mPadding)
>
> What should I use to get a blank space?
>
>
>
> Thanks
>
> Bill
Author
16 Jun 2006 11:16 PM
Bill Nguyen
Thanks Chris!
This seemed to work for me.

Bill

Show quoteHide quote
"Chris Dunaway" <dunaw***@gmail.com> wrote in message
news:1150492426.678759.132820@c74g2000cwc.googlegroups.com...
> PadRight does not change the string, it returns a new string that has
> been padded so you need a line like this:
>
> mdriverBegin = mdriverBegin.PadRight(16, mPadding)
>
>
> Bill Nguyen wrote:
>> I tried in vain to add blank space to the end of couple variables as
>> below:
>>
>> mPadding = Convert.ToChar(" ")
>>
>> mdriverBegin.PadRight(16, mPadding)
>>
>> mdriverEnd.PadRight(16, mPadding)
>>
>> mSitekey.PadRight(4, mPadding)
>>
>> What should I use to get a blank space?
>>
>>
>>
>> Thanks
>>
>> Bill
>