Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
At(my_memo)
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01396410
Message ID:
01396418
Views:
80
This message has been marked as a message which has helped to the initial question of the thread.
>Hi
>
>Is there any specific funcion to search for more than one occurrence of a string in a memo fied
>or a way to use at () funcion to do this ?
>
>I would like to get all lines numbers where the string appears in the memo and store into my_table_lines.dbf
>
>(Only the line numbers, not the string)
>
>Thanks
>
>Moises

Hi Moises,
May be with UDF
*** Search UPPER("mark")
CREATE CURSOR crsTestWithMemo (myMemo M)

TEXT TO lcstring NOSHOW
John Mark George Berbatov
John George berbatov
John MaRk
ENDTEXT

INSERT INTO crsTestWithMemo VALUES(m.lcString)
m.lcSearched = "mark"
DECLARE myArr[1]
LineForString(crsTestWithMemo.myMemo, m.lcSearched )

CLEAR
LIST MEMORY LIKE myArr
RETURN

FUNCTION LineForString (lcTest, lcSearched)
         lcTest = ALLTRIM(UPPER(m.lcTest))
         lcSearched = UPPER(m.lcSearched)
         
         lnLines = ALINES(ArrayName, m.lcTest)
         DECLARE myArr[m.lnLines]

         FOR lnLoop = 1 TO lnLines
             IF AT(m.lcSearched, ArrayName[m.lnLoop]) # 0
                myArr[m.lnLoop] = 1
             ELSE
                myArr[m.lnLoop] = 0
             ENDIF
         NEXT
RETURN ""
_______________________________________________________________
Testing displays the presence, not the absence of bugs.
If a software application has to be designed, it has to be designed correctly!
_______________________________________________________________
Vladimir Zografski
Systems Analyst
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform