Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need help making multiple changes in a memo field
Message
From
24/05/1999 14:27:16
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00222158
Message ID:
00222163
Views:
16
Hi Alan ---

Here's a thought: You can determine the position of a "[" and "]" through the AT() function. So, the following loop will scan through all of them. I am assuming a modal form that returns the replacement value:
nStartLeft=0
nStartRight=0
cMemoText=ALLT(table.memofield)
cReplacementText=""
DO WHILE AT(cMemoText,"[") # 0
   nStartLeft=AT(cMemoText,"[",nStartLeft+1)
   nStartRight=AT(cMemoText,"]",nStartRight+1)
   cTextToReplace=SUBSTR(cMemoText,nStartLeft+1,nStartRight-1)
   DO FORM frmGetReplaceText WITH cTextToReplace TO cReplacementText
   cTextToReplace="["+cTextToReplace+"]"

***** You need the STUFF function here to stuff cMemoText with 
***** cReplacementTExt....I don't have the manual here and can't 
***** remember the exact command parameters.

   nStartLeft=nStartLeft+1
   nStartRight=nStartRight+1
ENDDO
REPLACE table.memofield WITH cMemoText
>In part of my application, it is necessary to allow the user to replace one or more words/phrases in a memo field. The words/phrases to be replaced are enclosed in square brackets. What I want VFP 3.0 to do is "read" each replaceable word/phrase in turn, let the user enter other words/phrase to replace it, then go on to the next replaceable word/phrase.
>
>Any help on resolving this will be appreciated.
>
>Thanks,
>
>Alan
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform