Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Find number within string
Message
De
07/07/1999 09:49:12
 
 
À
07/07/1999 09:14:02
Nancy Folsom
Pixel Dust Industries
Washington, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00237774
Message ID:
00238249
Vues:
17
>Oh, posh! < bg >
>You all seem to be insisting on a whole lot more work than is necessary.
>If you run a character string thru VAL() and end up with a non-zero number, you have a number without any distracting inner characters.
>
x='2.5ab3'
>y=val(x) ?y && 2.50
>

I use exactly that technique in my sample code, Nancy; putting in whitespace for non-numerics makes parsing things easier, without having to examine stuff character by character.

>So if you have a string with a number that could be imbedded, you just have to strip off leading chars to get to it.
>
>I'd say Craig's suggestion would be needed if you want to find more than one imbedded number.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform