Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Extracting Data from String
Message
From
09/08/2017 12:09:42
 
 
To
09/08/2017 11:56:09
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:
01653175
Views:
50
>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

In your samples, you always remove the 8 last characters, is that always the case?

If so, this will do: ?left(ps,len(ps)-8)

If not, please provide some more realistic samples of what you have and what you want.
Previous
Reply
Map
View

Click here to load this message in the networking platform