RPAD
You are viewing an old version of this article. View
the current version here.
Syntax
RPAD(str, len [, padstr])
Description
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. If padstr
is omitted, the RPAD function pads spaces.
Prior to the version 10.3.1, the padstr
parameter was mandatory.
Examples
SELECT RPAD('hello',10,'.'); +----------------------+ | RPAD('hello',10,'.') | +----------------------+ | hello..... | +----------------------+ SELECT RPAD('hello',2,'.'); +---------------------+ | RPAD('hello',2,'.') | +---------------------+ | he | +---------------------+
See also
- lpad() ; Returns the string left-padded with another string to a given length
Comments
Comments loading...
Content reproduced on this site is the property of its respective owners,
and this content is not reviewed in advance by MariaDB. The views, information and opinions
expressed by this content do not necessarily represent those of MariaDB or any other party.