Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Function for Finding Word Position(NOT alphabet)
Message
From
20/08/2013 12:21:30
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01580784
Message ID:
01580823
Views:
38
>>>>Suppose I am having the following three strings
>>>>
>>>>403.879 378.665 MV (Higher Edu. CESS)SH
>>>>
>>>>456.597 337.070 MV (require any Signature)SH
>>>>
>>>>/F0 FF 7.0 SCF SF 403.879 400.524 MV (Service Tax)SH
>>>>
>>>>I need to extract the Values 403.879 & 378.665 from it (See first String).The above values are always before 'MV'
>>>>
>>>>I may use GETWORDNUM() But How will I get the Position of "MV" in Each string. The AT() Function gives me the character Postion of MV and not Word Position, I need the Word Position.
>>>>
>>>>How It will be Done ?
lcString = ">/F0 FF 7.0 SCF SF 403.879 400.524 MV (Service Tax)SH"
>>>st = LEFT(lcString,AT("MV",lcString) - 2)
>>>x = GETWORDNUM(st,GETWORDCOUNT(st)-1)
>>>y = GETWORDNUM(st,GETWORDCOUNT(st))
?
>>
>>The vfp blues ?
>
>Not really :-}
>
>>To do this, you need a reader that holds a queue of the - say - 20 next items ( lookahead)
>>A regex (or more than one) is needed to recognize the items - words, numbers, (strings). empty space is skipped
>>
>>You dequeue an item, if it is not of interest, enqueue it on the output queue
>>If it is of interest ( like MV), the two last items will still be on the output queue
>>
>>You can build a nice state machine
>
>>When the number of items in the output queue is above say 20, you start dequeuing the items and write them to the output stream until 20 are left in the queue
>
>In VFP ?


Of course -
Gregory
Previous
Reply
Map
View

Click here to load this message in the networking platform