Text parsing tools

From: <MSmith_at_ysi.com>
Date: Wed, 1 Nov 2000 15:54:39 -0500

There is a bug in COUNT-WORDS in the string manipulation tools in the FAQ
at
http://www.neverslow.com/fom/swiftforth/fom-serve/cache/67.html.
It counts a trailing white space as another word. It can be fixed as below.

S" one" COUNT-WORDS . 1 ok
S" one " COUNT-WORDS . 2 ok

: COUNT-WORDS
COUNT-WORDS isn't unique.
  0 >R BEGIN ATOKEN WHILE
    DROP R> 1+ >R
  REPEAT DROP 2DROP R> ; ok

S" one" COUNT-WORDS . 1 ok
S" one " COUNT-WORDS . 1 ok

Matt
Received on Wed Nov 01 2000 - 13:09:37 PST


Subscribe to our e-mail list service. It's free for all SwiftForth and SwiftX users!

This archive was generated 07-Feb-2012. Archive updated nightly.