Have we PadRight or PadLeft?

UnknownArt

Member
Licensed User
Longtime User
I want to know basic4ppc has the function as PadRight or PadLeft?

PadRight pads the right side of the string, and PadLeft pads the left side of the string.

For example, suppose MyString contains the value "23". Now consider this line:
MyString = MyString.PadRight(3)

After that line runs, MyString will contain the value "23 ", because it added enough characters to the right side of the string so that its length is now 3. Now suppose it's "23" again, and this line is run instead:
MyString = MyString.PadLeft(3)

Now MyString will be " 23", because it padded the left side. You can also tell these methods what character to put at the left or right. Assuming that MyString is "23" again:
MyString2 = MyString.PadRight(4, "0"c)
MyString3 = MyString.PadLeft(4, "0"c)

..MyString2 will be "2300", and MyString3 will be "0023". The addition of the extra argument (the "0"c) told it to add 0's to pad the strings.

Let me know if you have or other work around.
Thanks,
Mike
 
Top