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 - word() extract a word from a string http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 word()              Extract a word from a string
------------------------------------------------------------------------------
 Declaration
   string.hdr

 Syntax
   func char word extern
   param const char cString, ;
         value uint uWordPos

 Arguments
   cString is a character string.

   uWordPos is the token position of the word to extract.

 Return
   A substring extracted from the original string.

 Description
   This function returns the uWordPos-th word of cString. Valid word
   delimiters are spaces and tabs.

 Example
   #define EXAMPLE_STRING
   #include example.hdr

   proc WordParser
   param const char cText
   // Extract each word out of a string and display it
   vardef
      uint n
      char cToken
   enddef
   n := 1
   do while .not. isempty( cToken )
      cToken := word( cText, n )
      ? cToken
      n++
   enddo
   endproc
   
   proc Test_word
   WordParser( "To be or not to be that is the question" )
   endproc

   proc main
   Test_word()
   endproc

See Also: substr() token() tokenptr()

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