📣
TiDB Cloud Premium is now in public preview. Unlimited growth, instant elasticity, advanced security for enterprise workloads. Try it out →

RPAD



Returns the string str, right-padded with the string padstr to a length of len characters. If str is longer than len, the return value is shortened to len characters.

Syntax

RPAD(<str>, <len>, <padstr>)

Arguments

ArgumentsDescription
<str>The string.
<len>The length.
<padstr>The pad string.

Return Type

VARCHAR

Examples

SELECT RPAD('hi',5,'?'); +--------------------+ | RPAD('hi', 5, '?') | +--------------------+ | hi??? | +--------------------+ SELECT RPAD('hi',1,'?'); +--------------------+ | RPAD('hi', 1, '?') | +--------------------+ | h | +--------------------+

Was this page helpful?