Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Looking for a better way
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00211233
Message ID:
00211243
Views:
28
I know you are using the UPPER() function, so this may not answer your question, but have you considered the STRTRAN() function?

>This should be an easy one... for the life of me, I cannot think right. Vacation nearing.
>
>I've written a dumb little parser to scan through a memo field.
>
>You pass the String Text you wish to find... and the replacement
>value you wish to use. The problem... it very slow.
>
>Does anyone know of a better way to parse this memo ?
>
>Basically what I want to do is:
>1) USE ATCLINE() to locate the string.
>2) Grab lines 1 to ATCLINE() - 1 and place into var X1
>3) Recreate line ATCLINE() with the new value into var X2
>4) Grab lines ATCLINE() + 1 MEMLINES() and place into var X3
>5) Replace the memo field with X1 + X2 + X3
>
>Example:
>Memo Field contains 4 lines:
>This is line 1 - The time is 12:03 AM
>This is line 2 - The time is 12:04 AM
>This is line 3 - The time is 12:05 AM
>This is line 4 - The time is 12:06 AM
>
>Pass the method 2 parms: "12:05" and "XX:XX"
>x1 would be = 2:
>This is line 1 - The time is 12:03 AM
>This is line 2 - The time is 12:04 AM
>
>x2 would be = 2:
>"This is line 3 - The time is " + what ever + " AM"
>
>x3 would be = 2:
>This is line 4 - The time is 12:06 AM
>
>Final result would be:
>This is line 1 - The time is 12:03 AM
>This is line 2 - The time is 12:04 AM
>This is line 3 - The time is XX:XX AM
>This is line 4 - The time is 12:06 AM
>
>
>Any thought ?
>
>Pierre
>demester@VisualFoxPro.com
>
>Below is the code the wrotith...
>
>
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>PARAMETER cFindMe, cNewValue
>
>cFindMe = UPPER(cFindMe)
>cNewValue = UPPER(cNewValue)
>
>SELECT (oCusPublic.pTblName)
>
>IF !SEEK(oCusPublic.pProjId + oCusPublic.pSectId + oCusPublic.pPageId + oCusCode.pCurrentControl,(oCusPublic.pTblName),'SLink')
> =MessageBox('Object Not Found ~ Name: ' + cFindMe),64,'Notice')
> RETURN
>ENDIF
>
>* Locate The Actual Line In The Memo Field
>nLocateLine = ATCLINE(cFindMe, InitProp)
>
>IF nLocateLine = 0
> =MessageBox('Cannot Locate The Following Text:' + CHR(13) + cFindMe,64,'Notice')
> RETURN
>ENDIF
>* Save The Original Line
>cSaveLine = MLINE(InitProp,nLocateLine)
>
>* Where In The Original Line Does The Text Occur
>cParse1 = AT(cFindMe,cSaveLine)
>
>* Save The Text On The Line Which Occurs Before The Located Text
>cParse2 = SUBSTR(cSaveLine,1,cParse1 - 1)
>
>* Where Is The PropType Indicator
>cParse3 = AT('{PropType:',cSaveLine)
>
>* Save The Text On The Line Which Occurs Before The Located Text
>cParse4 = SUBSTR(cSaveLine,cParse3)
>
>cParse5 = cParse2 + cFindMe + cNewValue + cParse4 + CHR(13)
>
>nLineCount = MEMLINES(InitProp)
>cString = ''
>dString = ''
>FOR nLoop = 1 TO nLocateLine - 1
> dString = MLINE(InitProp,nLoop) + CHR(13)
> cString = cString + dString
>NEXT nLoop
>
>cString = cString + cParse5
>
>FOR nLoop = (nLocateLine) + 1 TO nLineCount
> dString = MLINE(InitProp,nLoop) + CHR(13)
> cString = cString + dString
>NEXT nLoop
>
>
>REPLACE InitProp WITH cString
Mark McCasland
Midlothian, TX USA
Previous
Reply
Map
View

Click here to load this message in the networking platform