Information.IsNumeric(Object) Metoda
Definice
Vrací Boolean hodnotu určující, zda lze výraz vyhodnotit jako číslo.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
Parametry
- Expression
- Object
Povinná hodnota.Required. Object vyjádření.Object expression.
Návraty
Vrací Boolean hodnotu určující, zda lze výraz vyhodnotit jako číslo.Returns a Boolean value indicating whether an expression can be evaluated as a number.
Příklady
Následující příklad používá IsNumeric funkci k určení, zda obsah proměnné lze vyhodnotit jako číslo.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)
Poznámky
IsNumeric Vrátí hodnotu True , pokud datový typ Expression je Boolean , Byte ,,, Decimal Double Integer , Long , SByte , Short , Single , UInteger , ULong , nebo UShort .IsNumeric returns True if the data type of Expression is Boolean, Byte, Decimal, Double, Integer, Long, SByte, Short, Single, UInteger, ULong, or UShort. Také vrátí, True Pokud Expression je Char , String nebo, Object které lze úspěšně převést na číslo.It also returns True if Expression is a Char, String, or Object that can be successfully converted to a number. Expression může obsahovat jiné než číselné znaky.Expression can contain non-numeric characters. IsNumeric Vrátí True Expression , pokud je řetězec, který obsahuje platné šestnáctkové nebo osmičkové číslo.IsNumeric returns True if Expression is a string that contains a valid hexadecimal or octal number. IsNumeric Vrátí také True Expression , zda obsahuje platný číselný výraz, který začíná znakem + nebo-nebo obsahuje čárky.IsNumeric also returns True if Expression contains a valid numeric expression that begins with a + or - character or contains commas.
IsNumeric Vrátí False Expression , pokud je datový typ Date .IsNumeric returns False if Expression is of data type Date. Vrátí, False Pokud Expression je Char , String nebo, Object které nelze úspěšně převést na číslo.It returns False if Expression is a Char, String, or Object that cannot be successfully converted to a number.