contents   index   previous   next



Character classification

 

JavaScript does not have a true character type. For the character classification routines, a chr is actually a single character string. Thus, actual programming usage is very much like C. For example, in the following fragment both Clib.isalnum() statements work properly.

 

var t = Clib.isalnum('a');

Screen.writeln(t);

 

var s = 'a';

var t = Clib.isalnum(s);

Screen.writeln(t);

 

This fragment displays the following.

 

true

true

 

In the following fragment, both Clib.isalnum() statements cause errors since the arguments to them are strings with more than one character.

 

var t = Clib.isalnum('ab');

Screen.writeln(t);

 

var s = 'ab';

var t = Clib.isalnum(s);

Screen.writeln(t);

 

All character classification methods return booleans: true or false.

 


Clib.isalnum()

Clib.isalpha()

Clib.isascii()

Clib.iscntrl()

Clib.isdigit()

Clib.isgraph()

Clib.islower()

Clib.isprint()

Clib.ispunct()

Clib.isspace()

Clib.isupper()

Clib.isxdigit()