String.pad_end
String.pad_end
Function
Pads content at the end of the string to the target length.
Syntax
string.pad_end(target_len, pad)
Parameters
| Parameters | Type | Required | Default value | Description |
|---|---|---|---|---|
| target_len | Number | Yes | None | Target length. |
| pad | String | No | Space | Pad text. |
Return value
| Type | Description |
|---|---|
| String | The new string after filling. |
Code Example
result = 'BT'.pad_end(4, '.') // Output: BT.. print result
Notes
- Return the original string when the current length is greater than or equal to the target length.