General information
Category:
Coding, syntax & commands
Michel,
The routine seems a little extravagant where it need not be.
The first REPLACE, which could well be executed several times, seems unnecessary to me - surely you could use a memvar instead and do the changes into it first??? Then *no* inner REPLACEs going on, so should be much faster.
Just a thought.
Cheers,
Jim N
>Thanks to Edward and Marc for having helped me in the STRTRAN to replace everything no matter what the case is.
>
>Here's the function I built to solve this:
>
>CheckIt('michel','notes')
>
>FUNCTION CheckIt
>* expC1 Text to replace
>* expC2 Name of the memo field
>PARAMETER tcText,tcMemo
>LOCAL lcText
>LOCAL lnPosition
>lnPosition=ATC(tcText,&tcMemo)
>DO WHILE lnPosition>0
> lcText=SUBSTR(&tcMemo,lnPosition,LEN(tcText))
>
> * Replace the memo field temporary with a string you can be sure is not part of it
> REPLACE (tcMemo) WITH STRTRAN(&tcMemo,lcText,'UNIVERSALTHREADONTOP')
>
> lnPosition=ATC(tcText,&tcMemo)
>ENDDO
>
>* Now, lets do the final replace
>REPLACE (tcMemo) WITH STRTRAN(&tcMemo,'UNIVERSALTHREADONTOP',tcText)
>
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only