Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Removing extra spaces and limiting input to A-Z, 1-0, an
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01159441
Message ID:
01159490
Vues:
16
>The sample of invalid characters was just that... a sample... to get a list of all Non A-Z,a-Z,0-9, you could build a loop at the front of your app and keep it defined once... then use that var elsewhere...
>
>
>lcAllInvalid = ""
>for lnI = 1 to 255
>  if not upper( chr( lnI )) $ "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
>    lcAllInvalid = lcAllInvalid + chr( lnI )
>  endif
>endfor
>
>
>This would get even those other special characters at upper levels...
>
>Then, to see if there WERE any invalid characters, you could do...
>
>
>if len( cString ) <> len( chrtran( cString, lcAllInvalid, "" ))
>  */ if string lengths are different, an invalid char was entered
>endif
>
Are you saying that the subset of invalid characters is limited too? I thought it's unlimited, since we can have chars in different languages...

Anyway, if you want to check, if your string has invalid chars, all you have to do is:
If not empty(lcString,lcAllowedChars,"")
   ** You have invalid chars in the string
endif
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform