웹이야기

[MySQL] RPAD() 본문

D/MySQL

[MySQL] RPAD()

yeon.Biju 2020. 4. 20. 12:20

MySQL 문자열 함수와 연산자

 

RPAD()

   -

 

RPAD(str, len, padstr)

의 형태

 

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. 

 

mysql> SELECT RPAD('hello', '10', '?' );
+---------------------------+
| RPAD('hello', '10', '?' ) |
+---------------------------+
| hello?????                |
+---------------------------+
1 row in set (0.00 sec)

 

mysql> SELECT RPAD('hello', '2', '?' );
+--------------------------+
| RPAD('hello', '2', '?' ) |
+--------------------------+
| he                       |
+--------------------------+
1 row in set (0.00 sec)

'D > MySQL' 카테고리의 다른 글

[MySQL]SPACE()  (0) 2020.06.11
[MySQL] RTRIM()  (0) 2020.04.20
[MySQL] RIGHT()  (0) 2020.04.20
[MySQL] REVERSE()  (0) 2020.04.20
[MySQL] REPLACE()  (0) 2020.04.20
Comments