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 - alltrim() remove leading and trailing spaces from a string http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 alltrim()           Remove leading and trailing spaces from a string
------------------------------------------------------------------------------
 Declaration
   string.hdr

 Syntax
   func char alltrim extern
   param const char cString

 Arguments
   cString is the source string to trim.

 Return
   The input string with leading and trailing spaces removed.

 Description
   The alltrim() function removes leading and trailing spaces from a string,
   i. e. it is equivalent to ltrim( rtrim( cString ) ).

 Example
   #define EXAMPLE_STRING
   #include example.hdr

   /*
   This example creates a string with both leading and trailing spaces, and
   then trims them with alltrim()
   */
   
   proc Test_alltrim
   vardef
      char cString
      char cTrimmed
   enddef
   cString := space( 10 ) + "Force" + space( 10 )
   cTrimmed := alltrim( cString )
   ? "|" + cString  + "|" + ", length is " + istr( len( cString  ) ) // length 25
   ? "|" + cTrimmed + "|" + ", length is " + istr( len( cTrimmed ) ) // length  5
   endproc

   proc main
   Test_alltrim()
   endproc

See Also: ltrim() rtrim() trim()

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