Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Opinions for best way to check a string for invalid Char
Message
De
19/02/1999 16:19:17
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00189473
Message ID:
00189502
Vues:
7
>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.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform