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 - space() returns a string of space characters http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 space()             Returns a string of space characters
------------------------------------------------------------------------------
 Declaration
   string.hdr

 Syntax
   func char space extern
   param value uint uChars

 Arguments
   uChars is the length of the output string.

 Return
   A space-filled string of the given length.

 Description
   The space() function returns a string of length uChars that is filled
   with space characters.

 Example
   #define EXAMPLE_STRING
   #include example.hdr

   //  A "center()" function.
   
   func char MyCenter
   param const char cString, value uint uWidth
   vardef
      uint nSpaces
   enddef
   nSpaces := ( uWidth - len( cString ) ) / 2
   return( space( nSpaces ) + cString + space( nSpaces ) )
   endproc
   
   proc Test_space
   vardef
      char cString
   enddef
   cString := space( 50 )
   ? len( cString )                      // prints 50
   ? ">" + cString + "<"                 // prints 50 spaces
   ? MyCenter( "Force", __max_col )
   endproc

   proc main
   Test_space()
   endproc

See Also: replicate()

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