Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Random text in memo field
Message
De
22/03/2023 13:34:57
 
 
À
22/03/2023 09:52:39
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01686399
Message ID:
01686400
Vues:
73
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform