The LPAD function pads a source string on the left with the first character of the specified padding until the resulting string is the specified length.
The LPAD function has the following format:
LPAD(source_string, length[, padding])
The LPAD function accepts the following parameters:
source_string (string)
This parameter can also be a number; it is automatically converted to a string.
length (number)
The number of characters of the final string.
padding (string)
(Optional) If the padding is more than one character long, only the first character is used. If the padding is zero length, no padding is done. If the source is a string and padding omitted, a space is used for padding. If the source is a number and padding is omitted, a zero is used for padding.
The LPAD function returns a string.
Result_value=LPAD('Juan', 5)
Result_value=' Juan'
Result_value=LPAD('Juan', 5, 'X')
Result_value= 'XJuan'
Result_value=LPAD('Juan', 6, 'XY')
Result_value= 'XXJuan'
Result_value=LPAD(5, 2)
Result_value= '05'
Result_value=LPAD(5, 2, ' ')
Result_value=' 5'
Copyright © 2010 CA. All rights reserved. | Email CA about this topic |