LPAD$ function

Purpose: LPAD$ pads the left side of a string with spaces or an optional fill character.


 Syntax:

 RetStr$ = LPAD$(MainStr$, MaxLength% [,OptionalFillChar%])

 Parameters:

  • RetStr$ Returned left padded MainStr$.
  • MainStr$ String to be left padded.
  • MaxLength% Combined length of MainStr$ and padding characters. If the length of MainStr$ is greater than or equal to MaxLength% then MainStr$ is returned. No truncation takes place.
  • OptionalFillChar% [OPTIONAL] ASCII code integer. Default fill character is ASCII 32(space).

Example:


 RetStr$ = LPAD$("123", 5) ' A$ would contain "  123"
 RetStr$ = LPAD$("123", 5, 66) ' A$ would contain "BB123"

RPAD$ function

Purpose: RPAD$ pads the right side of a string with spaces or an optional fill character.


 Syntax:

 RetStr$ = RPAD$(MainStr$, MaxLength% [,OptionalFillChar%])

 Parameters:

  • RetStr$ Returned right padded MainStr$.
  • MainStr$ String to be right padded.
  • MaxLength% Combined length of MainStr$ and padding characters. If the length of MainStr$ is greater than or equal to MaxLength% then MainStr$ is returned. No truncation takes place.
  • OptionalFillChar% [OPTIONAL] ASCII code integer. Default fill character is ASCII 32(space).

Example:


 RetStr$ = RPAD$("123", 5) ' A$ would contain "123  "
 RetStr$ = RPAD$("123", 5, 65) ' A$ would contain "123AA"