The pad() function creates a new string from string1 based on the specified length (length) and pad character (padchar). If string1 is shorter than the specified length, then it is padded by adding the appropriate number of the specified pad character to the end of the string. If string1 is longer than the specified length, then it is truncated and pad characters are not added. If the length of string1 is equal to the specified length, no changes are made and the original contents of string1 are returned in result.
The pad() function supports both single-byte and multiple-byte character sets.
result = pad (string1, length, padchar);
|string1||Required. The string field to pad using the specified pad character.|
Required. The length (number of characters) of the new string.
Required. The pad character that is used to pad string1, if string1 is shorter than the value specified in length.
result contains the new string.
string = "Jim White"; result = pad (string1, 10, "123");
In this example, result contains Jim White1.
string1 = "書策搜"; result = pad (string1, 4, "文");
In this example, result contains the value 書策搜文.