Previous: String Conversions, Up: Strings

### 5.5 Character Class Functions

Octave also provides the following character class test functions patterned after the functions in the standard C library. They all operate on string arrays and return matrices of zeros and ones. Elements that are nonzero indicate that the condition was true for the corresponding character in the string array. For example,

         isalpha ("!Q@WERT^Y&")
              => [ 0, 1, 0, 1, 1, 1, 1, 0, 1, 0 ]

— Mapping Function: isalnum (s)

> Return 1 for characters that are letters or digits (`isalpha (`s`)` or `isdigit (`s`)` is true).

— Mapping Function: isalpha (s)
— Mapping Function: isletter (s)

> Return true for characters that are letters (`isupper (`s`)` or `islower (`s`)` is true).

— Mapping Function: isascii (s)

> Return 1 for characters that are ASCII (in the range 0 to 127 decimal).

— Mapping Function: iscntrl (s)

> Return 1 for control characters.

— Mapping Function: isdigit (s)

> Return 1 for characters that are decimal digits.

— Mapping Function: isgraph (s)

> Return 1 for printable characters (but not the space character).

— Function File: isletter (s)

> Returns true if s is a letter false otherwise.

> See also: isalpha.

— Mapping Function: islower (s)

> Return 1 for characters that are lower case letters.

— Mapping Function: isprint (s)

> Return 1 for printable characters (including the space character).

— Mapping Function: ispunct (s)

> Return 1 for punctuation characters.

— Mapping Function: isspace (s)

> Return 1 for whitespace characters (space, formfeed, newline, carriage return, tab, and vertical tab).

— Mapping Function: isupper (s)

> Return 1 for upper case letters.

— Mapping Function: isxdigit (s)

> Return 1 for characters that are hexadecimal digits.