Skip to main content

.rjust()

A function that right-justifies a string within a given width by padding it with a specified character, or space by default.

Syntax

#fs.scripts.lib().rjust(string, width, character);

Parameters

string

The string to be right-justified.

width

The width of the field.

character (optional)

The character used for padding. If not provided, it defaults to a space.

Return

Returns a string.

Example

function(context, args) {
const l = #fs.scripts.lib();
const my_string = "hello";
const padding = "-";

return l.rjust(my_string, 10, padding);
}