Pad Text
Verb: padText
Pads a text by entering characters at the beginning or end of it based on the character used for padding and the maximum number of characters that text must have.
Syntax
padText --text(String) --type(PadType) --paddingchar(String) --length(Numeric) (String)=value
Inputs
Script | Designer | Required | AcceptedTypes | Description |
---|---|---|---|---|
--text | Text to Pad | Required | Text | Text that should be padded in by Character for Padding on the right or left. |
--type | Pad at | Required | PadType | Position where Character for Padding should pad in the text:
|
--paddingchar | Character for Padding | Required | Text | Character used to pad Text to Pad.
Only one character accepted. |
--length | Total length | Required | Number | Number of characters the text must have after padding. |
Outputs
Script | Designer | AcceptedTypes | Description |
---|---|---|---|
value | Text | Text | Left or right padded text with the character entered in the Character for Padding parameter, according to the maximum size entered in the Total length parameter. |
Example
Example 1: The command pads the text with the character "0" on the left, until it has a total of 5 characters, obtaining the result "00111".
defVar --name textToPad --type Numeric --value 111
defVar --name text --type String
// Pad in the text "111" with the character "0" on the left until the text is 5 characters long.
padText --text "${textToPad}" --type "Left" --paddingchar 0 --length 5 text=value
logMessage --message "${text}" --type "Info"
// This example produces the following result:
// Result: "00111"
Example 2: The command returns the text with the "0" character to its right, reaching a total of 5 characters.
defVar --name textToPad --type Numeric --value 111
defVar --name text --type String
// Pad in the text "111" with the character "0" on the right until the text is 5 characters long.
padText --text "${textToPad}" --type "Right" --paddingchar 0 --length 5 text=value
logMessage --message "${text}" --type "Info"
// This example produces the following result:
// Result: "11100"
Remarks
If the amount entered in the Total length parameter is less than or equal to the number of characters in Text to Pad, the return is itself Text to Pad, without any character addition.