Re: Turning a Text Sequence into a Sequence Array
- Posted by useless Jul 14, 2010
- 3261 views
Okay, thanks! I've always been wary of betas, but I'll give it a go! Thank you very much!
And, as far as I can tell, Kat's strtok.e seems to work pretty well with 3.11, here's a simple test, which DOES include an EXTRA SPACE between a couple of words:
include strtok-v2-1.e include get.e include misc.e object NULL sequence t, r t = "this is a test sentence with one extra space." r = parse(t, ' ') pretty_print(1, r, {3}) NULL = wait_key()
And here's the output: { "this", "is", "a", "test", "sentence", "with", "one", "extra", "space." }
Pretty simple, no?
Dan M.
Per the readme for v2.1, to get rid of that period (and other chaff) as well:
parse("this,is.a?test here",",.?") = {"this","is","a","test here"}
(note the space is not specified in this example)
Or:
parse("nick!ident@a.net","!@") = {"nick","ident","a.net}
but to KEEP the separators intact as separate tokens ("words", if you prefer):
parse("nick!ident@a.net",{"k","!@"}) = {"nick","!","ident","@","a.net"}
useless