Un petit script tout simple qui permet de vérifier qu'un caractère d'une chaine est bien un chiffre.
Voir les commentaires du script pour les détails.
//////////////////////////////////// // Verifier si c'est un chiffre // //////////////////////////////////// // Vérifie si le caractère à la position iPos de la chaine sString est un chiffre // ENTREE : sString : Le texte à tester // iPos : n° du caractère à tester (0 étant le 1er caractère de la chaine) // RETOUR : Renvoi TRUE si c'est un chiffre, sinon renvoi FALSE int GetIsNumber(string sString, int iPos=0) { string sCar=GetSubString(sString, iPos, 1); //Recupère le caractère à tester return (IntToString(StringToInt(sCar))==sCar)?TRUE:FALSE; //Effectue une comparaison et renvoi TRUE si c'est un chiffre, sinon c'est FALSE }
|