[REBOL] auto id's for vid objects
From: inetw3::mindspring::com at: 15-Feb-2004 21:34
Hey (smaller&smaller)List,
x: {button "one" button "two" text "browser"}
x marked strings are changed when
there found like this; {button one text "browser" button two}
but not when found like this;
{button one button two text "browser" }
notice the repeat "button" strings one
after another.
{button one button two}
code: -------------------------------------------
x: {button "one" button "two" text "browser"}
{then try this: button "one" text "browser" button "two"}
button_count: 0
txt_count: 0
btn: to-string reduce [ to-set-word 'id ": " to-set-word 'btn]
txt: to-string reduce [ to-set-word 'id ": " to-set-word 'txt]
parse x [any [
to "button" mark:(
remove/part mark 6 insert mark reduce [btn button_count: button_count + 1
:
{ }"button"])
:mark
to "text" mark:(
remove/part mark 4 insert mark reduce [txt txt_count: txt_count + 1
:
{ }"text"])
:mark
]skip
]
Does not *any and *skip find all occurrences of the marked string?
Or do I have to use a while loop?