Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Opinions for best way to check a string for invalid Char
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00189473
Message ID:
00189503
Vues:
9
>Thanks Mark,
>Actually, I need to check if there are characters outside of a list of valid characters. For example A-Z,a-z,0-9, are valid characters, how can I tell if an address has a value outside of these. I know I'm going to be using ASCII values, but what's the best way to search through the string? I use your method a lot myself when I know what I'm looking for. In this case it could be a rather large set of invalid characters, so I don't think it would be the best choice here. Thanks again.
>Marcus.
>
Hi Marcus,

You could use the foxtools function StrFilter(), and provide it with a list of the invalid characters (if it's smaller than the valid list). StrFilter removes instances of the characters that aren't in the list. Therefore, if the result string isn't empty, you know that there are some bad characters in there. You might also want to look at Reduce() in foxtools to remove these and/or any extra embedded spaces.

hth,
George

Ubi caritas et amor, deus ibi est
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform