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 - replicate() return string repeated a specified number of times http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 replicate()         Return string repeated a specified number of times
------------------------------------------------------------------------------
 Declaration
   string.hdr

 Syntax
   func char replicate extern
   param const char cString, ;
         value uint uRepeats

 Arguments
   cString is a character string.
   nRepeats is the number of times to repeat cString.

 Return
   A string containing the given number of repeats of the input string.

 Description
   The replicate() function produces a string that contains cString
   repeated uRepeats times. The maximum length of the returned string is
   254 characters.

 Example
   #define EXAMPLE_STRING
   #include example.hdr

   vardef static
      char cCheckTotal
   enddef
   
   proc Test_replicate
   // Make a string of '?' characters.
   ? replicate( "?", __max_col )
   // Put the "*" character before the amount when printing checks
   cCheckTotal := ltrim( str( 34287.60, 10, 2 ) )
   ? replicate( "*", 20 - len( cCheckTotal ) ) + cCheckTotal
   ? padl( cCheckTotal, 20, '*' ) // do the same using padl()
   endproc

   proc main
   Test_replicate()
   endproc

See Also: space()

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