Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Search for number characters in a string
Message
De
05/05/2016 05:16:06
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01635853
Message ID:
01635858
Vues:
61
>>I am going through a list of numbers as character string separated by periods - 04.05.10.11.12.100.101.104. etc and run into a problem when I reach 100+
>>my search for 10 comes up true when it comes across 100.
>>my search for 04 comes up true when it comes across 104 - so adding a dot after the search will not help.
>>
>>Is there a way to tighten up the code to get the query to reject these without my having to write qualifying if clauses after these searches.
>>thanks for any suggestions
>>k
>>
>>
>>num="100"
>>if '10' $ num
>>wait window 'I want this to show .f.'
>>endif
>>
>>**** same issue here with dot added to search
>>
>>num="104."
>>if '04.' $ num
>>wait window 'I want this to show .f.'
>>endif
>>
>>
>>
>>
>
>
>
>if ('.' + DesiredNum + '.')  $ ( '.' + num + '.')
>    number found
>else
>   exact number not found
This might have problems with the first item since the string does not start with a dot. Needs some additional handling, or a regexp.

An other approach would be to use ALINES() followed by ASCAN()
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord

Weeks of programming can save you hours of planning.

Off

There is no place like [::1]
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform