DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

ctype(TCL)


ctype -- test whether characters in a string are of a given class

Syntax

ctype [-failindex var] class string "

Description

ctype determines whether all characters in string are of the specified class. It returns 1 if they are all of class, and 0 if they are not, or if the string is empty. This command also provides another method (besides format and scan) of converting between an ASCII character and its numeric value. The following ctype commands are available:

ctype [-failindex var] alnum string
Tests that all characters are alphabetic or numeric characters as defined by the character set.

ctype [-failindex var] alpha string
Tests that all characters are alphabetic characters as defined by the character set.

ctype [-failindex var] ascii string
Tests that all characters are an ASCII character (a non-negative number less than 0200).

ctype char number
Converts the numeric value, number, to an ASCII character. number must be in the range 0 through 255.

ctype [-failindex var] cntrl string
Tests that all characters are control characters as defined by the character set.

ctype [-failindex var] digit string
Tests that all characters are valid decimal digits, that is, 0 through 9.

ctype [-failindex var] graph string
Tests that all characters are any character for which ctype print is true, except for space characters.

ctype [-failindex var] lower string
Tests that all characters are lowercase letters as defined by the character set.

ctype ord character
Converts a character into its decimal numeric value. The first character of the string is converted.

ctype [-failindex var] space string
Tests that all characters are either a space, horizontal-tab, carriage return, newline, vertical-tab, or form-feed.

ctype [-failindex var] print string
Tests that all characters are a space or any character for which ctype alnum or ctype punct is true or other printing character as defined by the character set.

ctype [-failindex var] punct string
Tests that all characters are made up of any of the characters other than the ones for which alnum, cntrl, or space is true.

ctype [-failindex var] upper string
Tests that all characters are uppercase letters as defined by the character set.

ctype [-failindex var] xdigit string
Tests that all characters are valid hexadecimal digits, that is 0 through 9, a through f or A through F.

If -failindex is specified, then the index into string of the first character that did not match the class is returned in var.


© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003