Triggers, performance and help with a replaceText script with start and end text matches

Peter M. Brigham pmbrig at gmail.com
Sun Jul 7 00:15:27 EDT 2013


On Jul 6, 2013, at 8:05 PM, Mark Rauterkus wrote:

> Desired result is to remove all the text starting with "Prior data:" and
> ending with "Concludes prior."

put fld "performance" into tText
put offset("Prior data: ", tText) into startChar
put offset("Concludes prior.",tText) + 15 into endChar
put newData into char startChar to endChar of tText
put tText into fld "performance"

This assumes you want to replace the "prior data: and the "Concludes prior." phrases as well. If you want to keep those words and just replace what is between them, do:

put fld "performance" into tText
put offset("Prior data: ", tText) + 11 into startChar
put offset("Concludes prior.",tText) -1 into endChar
put newData into char startChar to endChar of tText
put tText into fld "performance"

Easier yet if you have the "Prior data:" and "Concludes prior." on separate lines, with the data between them -- then use the lineoffset() function.

Is this the kind of thing you want?

-- Peter

Peter M. Brigham
pmbrig at gmail.com
http://home.comcast.net/~pmbrig





More information about the use-livecode mailing list