Click or drag to resize

IsDigit Function

X#
Determine if the leftmost character in a string is a digit (that is, a numeric digit between 0 and 9).

Namespace:  XSharp.Core
Assembly:  XSharp.Core (in XSharp.Core.dll) Version: 2.19
Syntax
 FUNCTION IsDigit(
	pszString AS STRING
) AS LOGIC
Request Example View Source

Parameters

pszString
Type: String
The string to examine.

Return Value

Type: Logic
TRUE if the first character of the string is a number from 0 to 9; otherwise; FALSE.
Remarks
IsDigit() is useful when you need to know if the current string is a number before converting it to a numeric value with the Val() function.
Examples
These examples demonstrate various results of IsDigit():
X#
1? IsDigit("AbcDe")                // FALSE
2? IsDigit("1abcd")                // TRUE
3? IsDigit(".12345")                // FALSE
See Also