Information.IsNumeric(Object) Método

Definición

Devuelve un valor de tipo Boolean que indica si una expresión puede evaluarse como un número.Returns a Boolean value indicating whether an expression can be evaluated as a number.

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

Parámetros

Expression
Object

Obligatorio.Required. Expresión Object.Object expression.

Devoluciones

Boolean

Devuelve un valor de tipo Boolean que indica si una expresión puede evaluarse como un número.Returns a Boolean value indicating whether an expression can be evaluated as a number.

Ejemplos

En el ejemplo siguiente se usa la IsNumeric función para determinar si el contenido de una variable se puede evaluar como un número.The following example uses the IsNumeric function to determine if the contents of a variable can be evaluated as a number.

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)

Comentarios

IsNumeric Devuelve True si el tipo de datos de Expression es Boolean , Byte , Decimal , Double , Integer , Long , SByte , Short , Single , UInteger , ULong o UShort .IsNumeric returns True if the data type of Expression is Boolean, Byte, Decimal, Double, Integer, Long, SByte, Short, Single, UInteger, ULong, or UShort. También devuelve True si Expression es un Char , String o que se Object puede convertir correctamente en un número.It also returns True if Expression is a Char, String, or Object that can be successfully converted to a number. Expression puede contener caracteres no numéricos.Expression can contain non-numeric characters. IsNumeric Devuelve True si Expression es una cadena que contiene un número octal o hexadecimal válido.IsNumeric returns True if Expression is a string that contains a valid hexadecimal or octal number. IsNumeric también devuelve True si Expression contiene una expresión numérica válida que comienza con un carácter + o-o contiene comas.IsNumeric also returns True if Expression contains a valid numeric expression that begins with a + or - character or contains commas.

IsNumeric Devuelve False si Expression es del tipo de datos Date .IsNumeric returns False if Expression is of data type Date. Devuelve False si Expression es un Char , String o Object que no se puede convertir correctamente en un número.It returns False if Expression is a Char, String, or Object that cannot be successfully converted to a number.

Se aplica a

Consulte también