Search / replace

Glen Bojsza gbojsza at gmail.com
Sat Feb 20 10:49:29 EST 2010


Yes, I discovered that no sleep (5 hours / two days)  and trying to solve
this was a disaster.

It also was a good reminder how good and responsive this list is!

I just got some sleep and saw the responses this morning.

thanks to everyone,

Glen

On Sat, Feb 20, 2010 at 6:53 AM, Jim Bufalini <jim at visitrieve.com> wrote:

> Jacque wrote:
>
> > This sounds like a perfect job for the replacetext command...
> > ...there's a way to do that but I'm not sure how.
> >
> > At any rate, once you get the right regex figured out, it's a one-liner
> > to do what you want.
>
> Glen, while Jacque works on a regex and after getting some sleep, ;-) here
> is the correct way to do what you want in a "readable" Rev loop (replace
> *FieldName* with the name of your actual field and put this code into a
> button):
>
> on mouseUp pMouseBtnNo
>    put replaceChar("[", the text of fld "FieldName") into fld "FieldName"
> end mouseUp
>
> function replaceChar pCharToReplace, pString
>    local tOffset
>    ----
>    repeat
>        put offset(pCharToReplace,pString) into tOffset
>         if tOffset = 0 then exit repeat
>         if char (tOffset - 1) of pString is an integer then
>            put "_" into char tOffset of pString
>        else
>            put empty into char tOffset of pString
>        end if
>    end repeat
>    return pString
> end replaceChar
>
> Aloha from Hawaii,
>
> Jim Bufalini
>
> _______________________________________________
> 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