LPAD()

Overview

Returns a string left-padded with the specified characters.

USAGE

LPAD(string, width, padding)

Argument Name

Description

string

The string to be padded

width

The desired width of the resulting string

padding

The string that is used for padding

DETAILS

LPAD() is a string function that returns a string left-padded in a field of the specified width using the specified padding string.

A string that is longer than the specified width is shortened to fit within the width.

A string that is shorter than the specified width has the remainder of the field with filled in with the padding characters, which are repeated if they are shorter than the needed padding length.

A NULL is returned if any argument is NULL.

SYNONYMS

SCHEMA

PARAMETERS

SKYSQL

PRIVILEGES

EXAMPLES

SELECT LPAD('Example', 15, '. ') AS result;
+-----------------+
| result          |
+-----------------+
| . . . . Example |
+-----------------+
SELECT LPAD('Example', 2, '~') AS r;
+------+
| r    |
+------+
| Ex   |
+------+
SELECT LPAD('FOO', 42, '_.~"~._.~"~._.~"~._.~"~.') AS result;
+--------------------------------------------+
| result                                     |
+--------------------------------------------+
| _.~"~._.~"~._.~"~._.~"~._.~"~._.~"~._.~FOO |
+--------------------------------------------+

ERROR HANDLING

FEATURE INTERACTION

RESPONSES

DIAGNOSIS

ISO 9075:2016

CHANGE HISTORY

Release Series

History

23.09

  • Present starting in MariaDB Xpand 23.09.1.

6.1

  • Present starting in MariaDB Xpand 6.1.0.

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Present starting in MariaDB Xpand 5.3.13.

Release Series

History

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Present starting in MariaDB Xpand 5.3.13.

Release Series

History

6.1

  • Present starting in MariaDB Xpand 6.1.0.

EXTERNAL REFERENCES