padRight

Summary

Pads the string with spaces from the right until it reaches the specified width (number of characters).

Signatures

Click on a signature to select it and view its documentation.

Usage

public string padRight(int width)

Returns

The string with spaces appended until it reaches the specified width.

Parameters

width

The width (number of characters) to expand the string to.

Description

Inserts spaces at the end of the string until it reaches the specified width (number of characters). If the string already equals or exceeds the specified width (number of characters), nothing will happen.

Examples

Basic Usage
1
2
3
4
5
6
import System;
 
string a = "a";
Console.log(a.padRight(4)); // "a   "
Console.log(a.padRight(1)); // "a"
Console.log(a.padRight(2)); // "a "

Share

HTML | BBCode | Direct Link