| xHarbour Reference Documentation > Function Reference |
![]() |
![]() |
![]() |
Checks if the first character of a string is a control character.
IsCntrl( <cString> ) --> lIsCtrlChar
The function returns .T. (true) when the leftmost character of a string is a control character, otherwise .F. (false).
The function is used to check if a string begins with a control character. It returns .T. (true) when the ASCII value of the first character is in the range 1-31 or is 127, and .F. (false) when it begins with any other character.
| See also: | IsAlNum(), IsAlpha(), IsAscii(), IsDigit(), IsGraph(), IsLower(), IsPrint(), IsPunct(), IsSpace(), IsUpper(), IsXDigit(), Lower(), Upper() |
| Category: | Character functions , xHarbour extensions |
| Source: | rtl\is.c |
| LIB: | xhb.lib |
| DLL: | xhbdll.dll |
// The example demonstrates various results of IsCntrl()
#define CRLF Chr(13)+Chr(10)
#define TAB Chr(9)
#define BELL Chr(7)
PROCEDURE Main
? IsCntrl( "ABC" ) // result: .F.
? IsCntrl( "xyz" ) // result: .F.
? IsCntrl( "123" ) // result: .F.
? IsCntrl( " xHarbour" ) // result: .F.
? IsCntrl( CRLF ) // result: .T.
? IsCntrl( TAB ) // result: .T.
? IsCntrl( BELL ) // result: .T.
RETURN
http://www.xHarbour.com