Conditional skip in parse
I needed to skip numbers in a string if they satisfy a condition. So I wrote this and I thought that it can help someone else.
alpha: charset [#"a" - #"z"]
digit: charset [#"0" - #"9"]
parse test [
some alpha m: copy v some digit (if even? to-decimal v [m: skip m length? v]) :m copy t
some [alpha | digit] (print t)
try to change the test, this parse rule will skip the arbitrary length of number if it is even.
posted by: Endo 24-May-2010/3:54:44-7:00
It will help me.
posted by: Steve Oldner 24-May-2010/7:08:08-7:00