home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 3 / AACD03.BIN / AACD / Programming / MUI / MCC_TextEditor / Demos / Rexx / CountWords.TEd next >
Encoding:
Text File  |  1997-09-30  |  375 b   |  25 lines

  1. /* Count words in the current document */
  2.  
  3. Address 'TEXTEDITOR-DEMO.1'
  4. Options Results
  5.  
  6. Words = 0
  7. GotoLine '-1'
  8. GetCursor Line
  9. Lines = RESULT
  10. GotoLine 0
  11.  
  12. Say "Contents:"
  13.  
  14. Do While(Lines >= 0)
  15.  GetLine
  16.  Contents = RESULT
  17.  Contents = Left(Contents, Length(contents)-1)
  18.  Words = Words+Words(Contents)
  19.  Say Contents
  20.  Lines = Lines-1
  21.  Line 1
  22. End
  23.  
  24. Say "Number of words: " || Words
  25.