MySQL lpad() function

The lpad() function returns the string str, and the left padding is padded with the string padstr to the length of len characters. If str is longer than len, the return value is shortened to len characters (ie, cannot exceed len).

mysql> SELECT LPAD('hi',4,'??');
+---------------------------------------------------------+
| LPAD('hi',4,'??')                                       |
+---------------------------------------------------------+
| ??hi                                                    |
+---------------------------------------------------------+
1 row in set (0.00 sec)

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325697273&siteId=291194637