isletter - Determine which characters are letters - MATLAB (original) (raw)
Main Content
Determine which characters are letters
Syntax
Description
TF = isletter([A](#bvidfjl-A))
returns a logical arrayTF
. If A
is a character array or string scalar, then the elements of TF
are logical 1
(true
) where the corresponding characters inA
are letters, and logical 0
(false
) elsewhere.
If A
is not a character array or string scalar, thenisletter
returns logical 0
(false
).
Examples
Create different arrays, and then determine which array elements are letters.
TF = 1×12 logical array
0 0 0 0 1 1 1 1 0 1 1 0
Convert chr
to a string, and test it. The input argument is not a character array, so isletter
returns 0
.
TF = 1×12 logical array
0 0 0 0 1 1 1 1 0 1 1 0
Input Arguments
Input array, specified as a scalar, vector, matrix, or multidimensional array. A
can be any data type.
Tips
To find letters within elements of a nonscalar string array, use the isstrprop function.
Extended Capabilities
Usage notes and limitations:
- Input values from the
char
class must be in the range 0-127.
Version History
Introduced before R2006a