Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Opinions for best way to check a string for invalid Char
Message
From
19/02/1999 16:19:17
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00189473
Message ID:
00189502
Views:
8
>I need to check names and addresses for invalid characters. What do you guys think is the best command/function to use for this. Thanks for your help.


Marcus,

Tried and true,
myTestString = UPPER(ALLTRIM(myTestString))

FOR i = 1 TO LEN(myTestString)
    IF !(LEFT(myTestString,i) $ "ABCDEFGHIJKLMNOP123456789")
        ? "Illegal character " + LEFT(myTestString,i)
    ENDIF
NEXT i
I have tried all types of fancy schemes, but for testing strings of less than 20 characters on average, this is by far the fastest.

regards,
Jim Edgar
Jurix Data Corporation
jmedgar@yahoo.com

No trees were destroyed in sending this message. However, a large number of electrons were diverted from their ordinary activities and terribly inconvenienced.
Previous
Reply
Map
View

Click here to load this message in the networking platform