padRight()

Pads the string with the specified character.

Syntax

public static String padLeft(String src, char padWith, int totalLen)
 

Parameters

src
The string to be padded.
padWith
The character used in padding.
totalLen
The new size of the string, a positive number. If the value is 0, smaller than the size of the original string, or a negative number, the original string is returned.

Return values

A new padded string.

Notes

Pads the string with a specified character.

Examples

The following call returns 1234500000:

padRight("12345", '0', 10); 
 

The following call returns 123456:

padRight("123456", '0', 5);
 

Copyright IBM Corp. 2003