Search / replace
Jim Bufalini
jim at visitrieve.com
Sat Feb 20 00:06:58 EST 2010
put "_" into char tTotalOffset of tFieldText
put empty into char tTotalOffset of tFieldText
or
replace char tTotalOffset of tFieldText with "_" in tFieldText
replace char tTotalOffset of tFieldText with empty in tFieldText
> -----Original Message-----
> From: use-revolution-bounces at lists.runrev.com [mailto:use-revolution-
> bounces at lists.runrev.com] On Behalf Of Glen Bojsza
> Sent: Friday, February 19, 2010 6:37 PM
> To: How to use Revolution
> Subject: Re: Search / replace
>
> Hi Jim,
>
> I appreciate your efforts.
>
> I was struggling with your last solution when I came back to check on
> the
> posts.
>
> Your new solution won't compile the following two lines?
>
> replace char tTotalOffset of tFieldText with "_"
>
> replace char tTotalOffset of tFieldText with empty
>
> Glen
>
> On Fri, Feb 19, 2010 at 9:19 PM, Jim Bufalini <jim at visitrieve.com>
> wrote:
>
> > Actually what I hastily typed into the last emails won't work. LOL!
> This is
> > because tOffset is always the "difference" between the starting point
> and
> > the found character. I really need to stop these quick answers! Try:
> >
> > On replaceChar
> > Local tOffset, tCharsToSkip, tFieldText, tTotalOffset
> > ----
> > put 0 into tCharsToSkip
> > put fld "theFieldName" into tFieldText
> > repeat
> > put offset("[",tFieldText,tCharsToSkip) into tOffset
> > if tOffset = 0 then exit repeat
> > put tCharsToSkip + tOffset into tTotalOffset
> > if char (tTotalOffset - 1) of tFieldText is an integer
> then
> > replace char tTotalOffset of tFieldText with
> "_"
> > put tTotalOffset + 1 into tCharsToSkip
> > else
> > replace char tTotalOffset of tFieldText with
> empty
> > put tTotalOffset into tCharsToSkip
> > end if
> > end repeat
> > put tFieldText into fld "theFieldName"
> > end replaceChar
> >
> > Now, if in this one, I misspelled something, just correct it. :-)
> >
> > Aloha from Hawaii,
> >
> > Jim Bufalini
> >
> >
> > > -----Original Message-----
> > > From: use-revolution-bounces at lists.runrev.com [mailto:use-
> revolution-
> > > bounces at lists.runrev.com] On Behalf Of Jim Bufalini
> > > Sent: Friday, February 19, 2010 5:52 PM
> > > To: 'How to use Revolution'
> > > Subject: RE: Search / replace
> > >
> > > I missed the *end if* ;-) (see below)
> > >
> > >
> > > > Glen Bojsza wrote:
> > > >
> > > > > Sorry to bother everyone but either I'm tired or brain dead.
> > > > >
> > > > > I have a field which has hundreds of lines.
> > > > >
> > > > > For all [ in the field I need to check to see if the character
> to
> > > > it's
> > > > > immediate left is a number.
> > > > >
> > > > > If it is a number then the [ is to be converted into an _.
> > > > >
> > > > > If it is not a number then the [ is to be removed (no
> substitution
> > > or
> > > > > spaces).
> > > > >
> > > > > I need to be able to cycle through the entire field which each
> line
> > > > may
> > > > > contain several [.
> > > > >
> > > > > Any thoughts would be appreciated as I have tried using a
> > > combination
> > > > > of
> > > > > find characters and foundchunk on the field without success.
> > > >
> > > > Use the *offset()* function as in:
> > > >
> > > > On replaceChar
> > > > Local tOffset, tCharsToSkip, tFieldText
> > > > ----
> > > > put 0 into tCharsToSkip
> > > > put fld "theFieldName" into tFieldText
> > > > repeat
> > > > put offset("[",tFieldText,tCharsToSkip) into tOffset
> > > > if tOffset = 0 then exit repeat
> > > > if char (tOffset - 1) of tFieldText is an integer
> then
> > > > replace char tOffset of tFieldText with "_"
> > > > put tOffset + 1 into tCharsToSkip
> > > > else
> > > > replace char tOffset of tFieldText with empty
> > > > put tOffset into tCharsToSkip
> > > END IF
> > > > end repeat
> > > > put tFieldText into fld "theFieldName"
> > > > 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
> > >
> > > _______________________________________________
> > > 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
> >
> > _______________________________________________
> > 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
> >
> _______________________________________________
> 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