Re: Turning a Text Sequence into a Sequence Array

new topic     » goto parent     » topic index » view thread      » older message » newer message
DanM said...
Kaladan said...

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

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu