VeloDB Cloud
SQL Manual
Functions
string-functions
rpad

rpad

Description

Syntax:

VARCHAR rpad (VARCHAR str, INT len, VARCHAR pad)

This function returns a string of length len in str, starting from the first letter of the string. If len is longer than str, it will appends the characters of pad to the end of str until the specified length is reached. If len is shorter than str, it will truncate the str string and return a string of the specified length. len is about character length but not bye size.

Example

mysql> SELECT rpad("hi", 5, "xy");
+---------------------+
| rpad('hi', 5, 'xy') |
+---------------------+
| hixyx               |
+---------------------+

mysql> SELECT rpad("hi", 1, "xy");
+---------------------+
| rpad('hi', 1, 'xy') |
+---------------------+
| h                   |
+---------------------+

Keywords

RPAD