Use this function to add trailing spaces or characters and return the result.
Parameter |
Description |
String |
Enter a valid string. The default is the value of the current field. |
Length |
Specify the desired length of output. The default is the length of value in the String parameter. |
Char |
Enter a valid string that contains the pad characters you want to use. The default is the space character. |
The system returns the string created by padding parameter 1 with the characters from parameter 3.
If the length specified in parameter 2 is longer than the string, the result is increased to the integer length you specified. If the specified integer length is less than the string, the length of the string is maintained.
The string is not truncated. All leading and trailing spaces are removed from the input string before the PAD function.
Here are some examples:
(Assume the current field contains the text Last Name Only.)
Function |
Result |
Explanation |
PAD("may ", 9) |
"may " |
Pad the result string to a length of 9. The pad character defaults to the space character. |
PAD ( , 20, !) |
"Last Name Only!!!!!!" |
Defaults to the current field, and adds the pad character (!) until the length reaches 20. |
PAD ( ) |
"Last Name Only" |
Defaults to the current field; No length was specified; therefore the field remains the same. |
PAD ("Ten dollars ", 15, *) |
"Ten dollars****" |
Adds the pad character (*) to the end of the specified parameter until the length reaches 15. Notice that the trailing spaces were first removed and then padded with the new character. |
© Copyright 2014, Oracle and/or its affiliates. All rights reserved. Legal notices.