| xHarbour Reference Documentation > Function Reference |
![]() |
![]() |
![]() |
Checks if the first character of a string is a digit.
IsDigit( <cString> ) --> lIsDigit
The function returns .T. (true) when the leftmost character of a string is a digit, otherwise .F. (false).
The function is used to check if a string begins with a digit. It returns .T. (true) when a string begins with a digit, and .F. (false) when it begins with any other character.
| See also: | IsAlNum(), IsAlpha(), IsAscii(), IsCntrl(), IsGraph(), IsLower(), IsPrint(), IsPunct(), IsSpace(), IsUpper(), IsXDigit(), Lower(), Upper() |
| Category: | Character functions |
| Source: | rtl\is.c |
| LIB: | xhb.lib |
| DLL: | xhbdll.dll |
// The example demonstrates various results of IsDigit()
PROCEDURE Main
? IsDigit( "ABC" ) // result: .F.
? IsDigit( " 10" ) // result: .F.
? IsDigit( "10" ) // result: .T.
? IsDigit( ".1" ) // result: .F.
? IsDigit( "-1" ) // result: .F.
RETURN
http://www.xHarbour.com