Re: String.PadLeft Method

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



How is this behavior not consistant with the documentation?

"Right-aligns the characters in this instance, padding on the left with
spaces or a specified Unicode character for a specified total length. "

If the size was < the length there would be no padding to perform.

Cheers,

Greg Young

"Reny" <reny@xxxxxxxxxx> wrote in message
news:%23Xpmwa2cGHA.1456@xxxxxxxxxxxxxxxxxxxxxxx
Hi,

I came across a doubt on the String.PadLeft Method.The doubt is this --
What's difference it make if the argument to this function carries an
integer whose value is less than the length of the string object

For example in the sample code below(VB.NET) I could not see any
difference



Dim str As String
str = "BBQ and Slaw"
Console.WriteLine(str.PadLeft(5)) ' Displays "BBQ and Slaw".

Console.WriteLine(str.PadLeft(15)) ' Displays " BBQ and Slaw".

I could not notice any difference with the output of str.PadLeft(5) and
the original str string.Both carries the same message "BBQ and Slaw"

Can any one tell me what is the use of this particular function if the
padleft paramater is less than the length of the string.

Reny



.



Relevant Pages

  • Re: PadLeft - What difference it make if the argument to this function carries an integer whose
    ... It is used to add padding to a string that is shorter than the number ... it doesn't need any padding. ... Console.WriteLine) ' Displays "BBQ and Slaw". ...
    (microsoft.public.dotnet.framework)
  • Re: REC: BBQ Mop and Rub
    ... chicken which is swimming in bottled BBQ sauce. ... In traditional BBQ ... of homemade cole slaw on top. ... but I've done ribs, chickens, briskets and sausages. ...
    (rec.food.cooking)
  • Re: Calhouns Barbecue found and judged
    ... rack of baby-back with slaw, baked beans and cornbread. ... Cornbread needed sugar, but I guess ... Lookee what crawls out when you start tallking BBQ. ...
    (rec.sport.football.college)
  • Re: Good BBQ in Memphis
    ... Most people I know here do not 'do' slaw. ... > an assumed topping when you made a BBQ (pulled pork) sandwich. ... That's because in North Carolina, they actually know what BBQ is! ...
    (alt.food.barbecue)