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 - pad() right-pad string with blanks http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 pad()               Right-pad string with blanks
------------------------------------------------------------------------------
 Declaration
   string.hdr

 Syntax
   func char pad extern
   param const char cString, ;
         value uint uLength

 Arguments
   cString is a character string.

   uLength is the length of the output string.

 Return
   A string derived from the input string, with trailing space 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 space 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_pad
   ? "[" + pad( "Hello",  3 ) + "]"
   ? "[" + pad( "Hello",  5 ) + "]"
   ? "[" + pad( "Hello", 10 ) + "]"
   ? "[" + pad( "Hello", 20 ) + "]"
   endproc

   proc main
   Test_pad()
   endproc

See Also: padr()

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