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 - padl() left-pad a string with fill character http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 padl()              Left-pad a string with fill character
------------------------------------------------------------------------------
 Declaration
   string.hdr

 Syntax
   func char padl 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 leading pad characters added
   to left-pad the string to the given length.

 Description
   This function returns a string with a length of uLength, made up of
   cString preceded by as many bChar characters that are needed to fill up
   the string to a length of uLength. The resulting string is left-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_padl
   ? padl( "hello  ",  3, '*' )  // Output: hel
   ? padl( "hello  ",  5, '*' )  // Output: hello
   ? padl( "hello  ", 10, '*' )  // Output: ***hello
   endproc

   proc main
   Test_padl()
   endproc

See Also: padc() padr()

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