webCOMAND

RPAD()

Return the string argument, right-padded with a specified string.

Prototype

int RPAD(string str, int length, string padstr)

Parameters

  • str - Original string to right-pad.
  • length - Length of final string to be returned, right-padding padstr as needed.
  • padstr - String to right-pad str with to reach the desired length.

Return

Returns the string str, right-padded with the string padstr to a length of length characters.  If str is longer than length, the return value is shortened to length characters.  The padstr will be repeated and potentially cut-off until the final string is length characters.

Example

SELECT OID, RPAD(Username, 20, '-') AS PaddedUsername FROM User

Related

LPAD()