Hi Brenda,
The trick with variable length substrings like this is to start at the end and work your way backwards. Example code below...
Local laSearch(6,2)
laSearch(1,1) = "Subdivision:"
laSearch(2,1) = "Range:"
laSearch(3,1) = "Defendant(s):"
laSearch(4,1) = "Township:"
laSearch(5,1) = "Section:"
laSearch(6,1) = "Plaintiff(s):"
For lnCounter = 1 To Alen(laSearch,1)
laSearch(lnCounter,2) = Extract(@lcTheString, laSearch(lnCounter,1))
? laSearch(lnCounter,2)
EndFor
Function Extract(lcTheString, lcSearchedFor)
Local lcResult
lcResult = Substr(lcTheString, At(lcSearchedFor, lcTheString))
lcTheString = Substr(lcTheString, 1, At(lcSearchedFor, lcTheString)-1)
Return lcResult
EndFunc
Regards,
Liam
>I need some string help. I am downloading a web page a local file and then writing a small program to pull the data from it. The HTML code is striped and all I have left are the text labels, the data, and the ending . I want everything between the text labels and the ending .
>
>An example is below. The text labels are always the same, and always in the same order - "Plaintiff(s):" "Section:" "Township:" etc.
>
>I have wrestled with this for over 3 hours and still only have some sloppy code to extract each of the data elements into their own data field. HELP.
>
>Plaintiff(s):The First National Bank of Chicago, as Trustee, etc. Section: Township: Defendant(s):Jonathan Mescon, if living or dead, the unk spouse, heirs, etc., et al Range: Subdivision: Knollwood
>
>Thanks
>
>Brenda
Liam O'Hagan
MCP VFP Desktop Apps