Hello Eric:
That did it!! Thanks so much. I have to say that
I haven't looked at the list too much, so let me ask
you this:
I've been programming in C/C++ for years, and have
built numerous libraries of reusable code and useful
classes.
Does rebol have a parallel strategy?
Any suggestions?
Thanks, Eric
:) Tim
At 11:25 AM 2/9/00 +0900, you wrote:
Hi Tim,
REMOVE removes by default the first element of a series. So when you say
remove first fp
the first element of FP is a string, and REMOVE will remove the first
element of that string. You want to zap the whole string, I take it,
so you should do:
remove fp
Here's a function based on your code to do what you want. I changed
remove-flag to a true/false flag, which is easier to test for. Also,
when you go through a series deleting some items and skipping others,
FORALL doesn't give you enough control. You have to use
while [ not tail? series-value ] [ ... ]
and use either NEXT or REMOVE every time you go through the loop.
remove-text: func [fp [file!]][
fp: open/lines fp
remove-flag: false
lines-done: 0
while [ not tail? fp ] [
if find first fp "begin insert here" [
print "found"
remove-flag: true
]
either remove-flag [
either find first fp "end insert here" [
remove-flag: false
print "done"
fp: next fp
][
either zero? lines-done [
print "setting lines-done"
lines-done: 1
fp: next fp
][
print ["Removing " first fp]
remove fp
]
]
][
fp: next fp
]
]
update fp
close fp
]
See you,
Eric