Determining the class of a string
Although a string is generally considered to be an alphanumeric character, it can also belong to a class of strings. These classes allow us to manipulate the string in a manner consistent with its class type. For example, adding 1 to the character # will produce an error or unexpected return value. To assist us in determining the class of the string, Tcl provides the is
keyword and a list of associated classes.
The syntax for the string
command is as follows:
string is class strict failindex variable string
When invoked with the is
keyword the command will return 1, if the class is matched.
The classes is
will check for are as follows:
Class |
Description |
---|---|
|
Any Unicode alphabetic or digit character. |
|
Any Unicode alphabetic character. |
|
Any character with a value less than \u0080 (those that are in the 7-bit ASCII range). |
|
Any of the forms allowed by TCL_GetBoolean. |
|
Any Unicode control character. |
|
Any... |