Declaration
RPAD(str,len,padstr)
Description
The padstr function pads the right side of the string str with the character string filler until the length of str is len.
If the length of
stris greater thanlen, return the firstlencharacters ofstr.If the length of
stris less thanlen, and the concatenated length ofstrandpadstris greater thanlen, then the firstlencharacters of the concatenated string are returned.If the length of
stris less thanlen, or the concatenated length ofstrandpadstris less thanlen, then return the firstlencharacters of the concatenation ofstrand multiple repetitions ofpadstr(with a total length greater than or equal tolen).
Examples
obclient> SELECT RPAD('hi',5,'?');
+------------------+
| RPAD('hi',5,'?') |
+------------------+
| hi??? |
+------------------+
1 row in set
obclient> SELECT RPAD('hi',1,'?');
+------------------+
| RPAD('hi',1,'?') |
+------------------+
| h |
+------------------+
1 row in set