Replace command

Michael Kann mikekann at yahoo.com
Sat Apr 10 11:17:37 EDT 2010


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
----------------------

--- On Sat, 4/10/10, David Coker <davidocoker at gmail.com> wrote:

> From: David Coker <davidocoker at gmail.com>
> Subject: Replace command
> To: "How to use Revolution" <use-revolution at lists.runrev.com>
> Date: Saturday, April 10, 2010, 9:46 AM
> Howdy folks,
> Ran across another head scratcher that I need some help
> with.
> 
> Let's say I have put the following tongue twister into a
> variable
> called tContainer:
> 
> Peter Piper picked a peck of pickled peppers.
> If Peter Piper picked a peck of pickled peppers,
> then where's the peck of pickled peppers that
> Peter Piper picked?
> 
> the code:
> replace "Piper" with "Jones" in tContainer
> 
> ... obviously replaces every instance of the matching word
> found in
> the container.
> 
> Am I overlooking a simple way to limit the number of
> matching words to
> only one occurrence, other than processing the contents one
> line at a
> time outside of the container?
> 
> If there is some other such command or function in RevTalk,
> I have
> completely overlooked it and badly need some guidance.
> 
> Best regards,
> David C.
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage
> your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
> 


      



More information about the use-livecode mailing list