Adrian Nier Code

Back to overview

Padded string

Last modification: Monday, August 25, 2008 12:47 am

Pads a string to the desired length by prefixing the string with the specified character.

Required parameters
Parameter 1 (string)
The string to be padded.

Parameter 2 (string)
The string to use as padding.

Parameter 3 (integer)
The length of the desired padded string.

Implementation

on paddedString(_string, _padding, _length)
   
   repeat _length - (count of _string) times
      set _string to _padding & _string
   end repeat
   
   return _string
   
end paddedString