Skip to content

String.PadEnd

boxgaming edited this page Aug 5, 2025 · 3 revisions

Pads a string with a given string (repeated and/or truncated, if needed) so that the resulting string has a given length. The padding is applied from the end of this string.

Syntax

result$ = String.PadEnd (s$, targetLength% [,__padStr%_])

Parameters

  • The s$ parameter contains the string to pad.
  • targetLength% specifies the length of the resulting string once the current str has been padded.
  • The optional padStr$ parameter contains the string to pad the current s$ with. If padStr$ is too long to stay within targetLength%, it will be truncated from the end. The default value is the space character.

Example

Import String From "lib/lang/string.bas"

Print String.PadEnd("monkeys", 25, ".")
Print String.PadEnd("kangaroos", 25, ".")
Print String.PadEnd("alligators", 25, ".")

Output

monkeys..................
kangaroos................
alligators...............

See Also

String.PadStart
Javascript - String.padEnd()

Clone this wiki locally