Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Extracting Data from String
Message
From
09/08/2017 12:21:58
 
 
To
09/08/2017 12:15:38
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 8
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01653172
Message ID:
01653180
Views:
57
>>>>Respected All. Need help in a small coding/command.
>>>>I have following Data for example
>>>>
>>>>PS="F9 B ( A/P LONI\(BK\) TL SHRIRAMPU)31 588 w"
>>>>PS="SX B X (A/P) 37 588 n"
>>>>PS="F6 B ( (K) /A/P LONI\(BK\) (TL) SHRIRAMPU)31 588 w"
>>>>
>>>>I Need to Extract Data from PS in the following Manner for these three cases as follows
>>>>
>>>>F9 B ( A/P LONI\(BK\) TL SHRIRAMPU)
>>>>SX B X (A/P)
>>>>F6 B ( (K) /A/P LONI\(BK\) (TL) SHRIRAMPU)
>>>>
>>>>i.e I need Text from first Left Digit to the Last Right Digit Except "31 588 w"
>>>>
>>>>If I am using NEWPS=STREXTRACT((PS),'',')') I am getting result as
>>>>
>>>>F9 B ( A/P LONI\(BK\ and the rest of the part is ignored.
>>>>
>>>>Similarly for F6 B ( (K) /A/P LONI\(BK\) (TL) SHRIRAMPU) I am getting F9 B ( A/P LONI\(BK\
>>>>
>>>>I need the entire Text starting from Left "F" till the last Bracket i.e if
>>>>
>>>>PS="PS="F6 B ( (K) /A/P LONI\(BK\) (TL) SHRIRAMPU)31 588 w"
>>>>
>>>>I need
>>>>
>>>>F6 B ( (K) /A/P LONI\(BK\) (TL) SHRIRAMPU)
>>>>
>>>>Please Guide or provide Appropriate Syntax
>>>>Regards
>>>>Harsh
>>>
>>>Just to be sure: the sequence "31 588 w" is always in this format? That is, two digits, a space, three digits, another space, and a single letter? Or can it be something else?
>>
>>Sir there would always be last three Digits/Texts as I mentioned. However there may be case where there can be )31 588 w (i.e ")31" without space) or ) 31 588 w ((i.e ")31" with space)
>>or )31 588 x or ) 31 588 x and likewise.
>>
>>However From Right to Left there will always be a letter followed by two digits then the Bracket ")".
>
>
?left(ps,rat(")",ps))
Great Sir, Thanks Very Much, Its working fine in all cases.
Regards
Harsh
Harsh
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform