---
url: /flow/guide/scripting-reference/functions/string/rightpad.md
---

# RightPad

## Declaration

`Function RightPad( S : string; Ch : Char; Len : Integer) : string`

### Example

```pascal
procedure OnMapEvent(var Value:Variant);
begin
  Value := RightPad('abc','1',5); //returns '11abc' - two padding characters added, leaving S right-justified
  Value := RightPad('abc','1',2); // returns 'abc' - no padding necessary (and no truncation)
end;
```

## Description

Returns string S right-justified within the output, and padded with the Ch character (on the left) if necessary to make the output up to length Len.

Note: Example and Description corrected November 2011. Previous version had LeftPad and RightPad interchanged.
