Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Newbie Q: Search and delete from a Block

From: rotenca:telvia:it at: 9-Oct-2002 23:25

Hi Doc,
> (I usually do not use 'replace mezzanine in my code unless i don't care
about
> speed)
Time to try to speed up replace? This is my first try (+ 100% in my system) . Anything better? (I'm using more and more parse and i usually reach more fast loop (+50% - +100%), more compact and more readable code.) replace: func [ {Replaces the search value with the replace value within the target series. Changed by ana} target [series!] "Series that is being modified." search "Value to be replaced." replace "Value to replace with." /all "Replace all occurrences." /case "Case-sensitive replacement." /local start end rule ][ rule: [to search start: search end: opt (end: change/part start replace end) :end] if all [any-string? target any [not any-string? :search tag? :search]] [search: form :search] if all [rule: reduce ['some rule]] either case [parse/all/case target rule][parse/all target rule] target ] --- Ciao Romano