Information.IsNumeric(Object) Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Retourne une valeur Boolean indiquant si une expression peut être évaluée comme un nombre.
public:
static bool IsNumeric(System::Object ^ Expression);
public static bool IsNumeric (object? Expression);
public static bool IsNumeric (object Expression);
static member IsNumeric : obj -> bool
Public Function IsNumeric (Expression As Object) As Boolean
Paramètres
- Expression
- Object
Obligatoire. Expression Object.
Retours
Retourne une valeur Boolean indiquant si une expression peut être évaluée comme un nombre.
Exemples
L’exemple suivant utilise la IsNumeric fonction pour déterminer si le contenu d’une variable peut être évalué en tant que nombre.
Dim testVar As Object
Dim numericCheck As Boolean
testVar = "53"
' The following call to IsNumeric returns True.
numericCheck = IsNumeric(testVar)
testVar = "459.95"
' The following call to IsNumeric returns True.
numericCheck = IsNumeric(testVar)
testVar = "45 Help"
' The following call to IsNumeric returns False.
numericCheck = IsNumeric(testVar)
Remarques
IsNumericretourne True si le type de données de Expression est Boolean, Byte, DoubleDecimal, Integer, Long, SByte, Short, SingleUInteger, , ULong, ou UShort. Elle retourne True également si Expression est un Char, Stringou Object qui peut être correctement converti en nombre.
Expression peut contenir des caractères non numériques.
IsNumeric retourne True si Expression est une chaîne qui contient un nombre hexadécimal ou octal valide.
IsNumeric retourne True également si Expression contient une expression numérique valide qui commence par un caractère + ou - ou contient des virgules.
IsNumeric retourne False si Expression est de type Datede données . Elle retourne False si Expression est un Char, Stringou Object qui ne peut pas être correctement converti en nombre.