Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Find number within string
Message
De
06/07/1999 14:54:27
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00237774
Message ID:
00237887
Vues:
13
>Not to seem ignorant...foxtools? what's that? and where do I get it?
>Thanks for your reply:)
>
>>
>>Hi John,
>>
>>The first idea that comes to mind requires foxtools. It contains a function, StrFilter(). You'd use it this way:
>>
>>lcnumbers = StrFilter("#70 blue", "0123456789")
>>
>>lcnumbers would then equal "70".

FoxTools is free for FFDB club members :)

The first idea that came to my mind is that you may have more than one number in your string, so this is what I'd do in that case - I'd include the digits and a space in the string, so:
lcNumbers=StrFilter("#70 blue #23 green #00 amber" , " 0123456789")
for i=1 to words(lcNumbers)
   ? val(wordnum(lcNumbers,i))
endfor
It should print
       70
       23
         0
A word of caution: Foxtools functions are not working with strings longer than 255 or with memo fields in some versions of VFP - for memos, though, it's no problem - just use ""+memofield as parameter.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform