Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Opinions for best way to check a string for invalid Char
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00189473
Message ID:
00189503
Views:
8
>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
Previous
Reply
Map
View

Click here to load this message in the networking platform