DSQL, PSQL

    Possible name conflict

    YES →

    Syntax

    Result type

    VARCHAR or BLOB

    Description

    Left-pads a string with spaces or with a user-supplied string until a given length is reached.

    • This function fully supports text BLOBs of any length and character set.

    • If padstr is given and equals '' (empty string), no padding takes place.

    Examples

    1. lpad ('Hello', 12) -- returns ' Hello'
    2. lpad ('Hello', 12, '') -- returns 'Hello'
    3. lpad ('Hello', 12, 'abcdefghij') -- returns 'abcdefgHello'
    4. lpad ('Hello', 2) -- returns 'He'
    5. lpad ('Hello', 2, '-') -- returns 'He'

    See also

    RPAD()