Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
STRTRAN no matter the case
Message
From
25/09/1997 18:13:22
 
 
To
25/09/1997 16:45:11
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00051670
Message ID:
00051682
Views:
30
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
Map
View

Click here to load this message in the networking platform