Return a Padded String with Blanks on Right

Category:
String Manipulation
Type:
Snippets
Difficulty:
Beginning
Author:
Waty

Version Compatibility:

More information:
This function takes a string and a number as a parameter. The number represents the total length of the string to be returned, with spaces added to the right if the number is greater then the length of the passed string. If the passed length value is less than the length of the passed string, the return value will be a truncated string.

Example: PadR("Test", 6) returns:

Test    (Test with two spaces to the right).

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: