Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - padr() right-pad a string with fill character http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 padr()              Right-pad a string with fill character
------------------------------------------------------------------------------
 Declaration
   string.hdr

 Syntax
   func char padr extern
   param const char cString, ;
         value uint uLength, ;
         value byte bChar

 Arguments
   cString is a character string.

   uLength is the length of the output string.

   bChar is the pad character.

 Return
   A string derived from the input string, with trailing pad characters
   added to right-pad the string to the given length.

 Description
   This function returns a string with a length of uLength, made up of
   cString followed by as many bChar characters that are needed to fill up
   the string to a length of uLength. The resulting string is right-padded
   to uLength.

   If the length of cString is larger than uLength then the string
   is trimmed to uLength.

 Example
   #define EXAMPLE_STRING
   #include example.hdr

   proc Test_padr
   ? padr( "hello  ",  3, '*' )  // Output: hel
   ? padr( "hello  ",  5, '*' )  // Output: hello
   ? padr( "hello  ", 10, '*' )  // Output: hello  ***
   endproc

   proc main
   Test_padr()
   endproc

See Also: padc() padl()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson