Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Strip leading zeros
Message
De
20/10/2009 19:03:33
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
20/10/2009 18:56:13
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
Divers
Thread ID:
01430254
Message ID:
01430264
Vues:
58
In the present case, wouldn't it be simpler to do a padl(...) on whatever the user types, before doing the comparison?

>Thanks a bunch for the link. I think Hilmar's solution works best for me.
>CHRTRAN(LTRIM(CHRTRAN(charvalue,"0"," "))," ","0")
>
>Thanks Hilmar!!!!
>
>
>>See also Re: Simple math problem Thread #1122177
>>
>>>Please Note: VFP 8
>>>
>>>I have a table with a PONUM field. It is a 10 character string. When the field is populated it is with PADL(value,10,"0"). While value is usually a number, it occasionally has a character in it so we could see (for example), 00001234-1
>>>
>>>I need an expression that essentially strips away the leading zeros and allows a comparison to another value. So if the user enters "2" we would filter by/select all records where the first non-zero character would be "2", getting (with EXACT OFF)......
>>>
>>>"0002567890"
>>>"0000027890"
>>>"00002678-1"
>>>"0000000002"
>>>etc.
>>>
>>>If not for the potential non-numeric characters I think I could use
TRANSFORM(VAL(value)) = "2"
but as the user enters more characters to refine the filter, I need to be able to account for those non-numerics.
>>>
>>>All suggestions muchly appreciated
>>>
>>>...........Rich
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform