Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Random text in memo field
Message
From
22/03/2023 13:34:57
 
 
To
22/03/2023 09:52:39
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01686399
Message ID:
01686400
Views:
72
>Hello all,
>
>In my table there is a memo field. In that memo field I will have products description with or without prices. It will go liike this
>
>Product A 10$
>Product B 20$
>Product C
>Product D
>
>I want to extract only the product descriptions without the costs.
>
>Data that will go in the table could be entered manually by a user or with a paste because the user did a copy (ctrl-C) from an excel sheet.

If you know for sure that the price part will contain only digits and a dollar sign, you could use CHRTRAN() to eliminate those characters:
DescOnly = CHRTRAN(MemoField,'0123456789$','')
However, if you might have commas and periods, it gets harder because those can appear in the descriptions, too. In that case, loop through the possible start characters for the price, using AT() to find out where that part starts. Then grab the front of the string.

One other idea. If you can be sure the price part has no embedded spaces, use RAT() to find the rightmost space and keep everything in front of that.

Tamar
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform