On Apr 10, 2010, at 11:52 AM, David Coker wrote:
Mark wrote:
put "Jones" into word wordOffset("Piper",tContainer) of tContainer
then Michael added:
put
Peter Piper picked
If Peter Piper picked again
into fld 1
-----------------------------
-- use this script
-----------------------------
on mouseUp
put wordOffset("Peter",fld 1) into x
put "Jones" into word x of fld 1
end mouseUp
----------------------
There seems to be an easy consensus, so that's the direction I'll take
my code...
Up until now I have never attempted using the wordOffset function for
the small things I've been building with Rev, so I guess it's time to
work it into my coding routines for the future.
Thank you folks so much for the advice and samples!
Best regards,
David C.
The code above will find and replace the first occurrence of the
string. For access to all the occurrences, use this handler:
function offsets str,cntr
-- returns a comma-delimited list
-- of all the offsets of str in cntr
if str is not in cntr then return 0
put "" into offsetList
put 0 into startPoint
repeat
put offset(str,cntr,startPoint) into thisOffset
if thisOffset = 0 then exit repeat
add thisOffset to startPoint
put startPoint & comma after offsetList
end repeat
delete last char of offsetList
return offsetList
end offsets
-- Peter
Peter M. Brigham
pmb...@gmail.com
http://home.comcast.net/~pmbrig
_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution