Documentation

isletter

Determine which character array elements are letters

Syntax

TF = isletter(A)

Description

example

TF = isletter(A)returns a logical arrayTF. IfAis a character array, the elements ofTFare logical1(true) where the corresponding elements ofAare letters, and logical0(false) elsewhere.

IfAis not a character array, thenisletterreturns logical0(false).

Examples

collapse all

Create different arrays, and then determine which array elements are letters.

chr ='123 Main St.'
chr = '123 Main St.'
TF = isletter(chr)
TF =1×12 logical array0 0 0 0 1 1 1 1 0 1 1 0

Starting in R2016b, you can convert character arrays to strings using thestringfunction. Convertchrto a string, and test it. The input argument is not a character array, soisletterreturns0.

str = string(chr)
str = "123 Main St."
TF = isletter(str)
TF =logical0

Input Arguments

collapse all

Input array, specified as a scalar, vector, matrix, or multidimensional array.Acan be any data type.

Tips

To find letters within elements of a string array, use theisstrpropfunction.

Extended Capabilities

Introduced before R2006a

Was this topic helpful?