0
0
0
0
1
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
1
0
0
0
The isstrprop function can query characters for many different traits. isstrprop can determine
whether characters in a string or character vector are letters, alphanumeric characters, decimal or
hexadecimal digits, or punctuation characters.
Determine which characters in a string are punctuation marks. isstrprop returns a logical vector
whose length is equal to the number of characters in str.
str = "A horse! A horse! My kingdom for a horse!"
str =
"A horse! A horse! My kingdom for a horse!"
isstrprop(str,"punct")
ans = 1x41 logical array
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
Determine which characters in the character vector chr are letters.
isstrprop(chr,"alpha")
ans = 1x30 logical array
1
1
1
1
0
1
1
1
1
1
0
1
1
1
0
1
1
1
1
1
0
1
1
1
See Also
strcmp | sort | isstrprop | isletter | isspace | eq | ne | gt | ge | le | lt
Related Examples
•
“Text in String and Character Arrays” on page 6-2
•
“Create String Arrays” on page 6-5
•
“Analyze Text Data with String Arrays” on page 6-15
•
“Search and Replace Text” on page 6-37
•
“Test for Empty Strings and Missing Values” on page 6-20
6 Characters and Strings
6-36
0
0
0
1
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
1
0
0
0
The isstrprop function can query characters for many different traits. isstrprop can determine
whether characters in a string or character vector are letters, alphanumeric characters, decimal or
hexadecimal digits, or punctuation characters.
Determine which characters in a string are punctuation marks. isstrprop returns a logical vector
whose length is equal to the number of characters in str.
str = "A horse! A horse! My kingdom for a horse!"
str =
"A horse! A horse! My kingdom for a horse!"
isstrprop(str,"punct")
ans = 1x41 logical array
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
Determine which characters in the character vector chr are letters.
isstrprop(chr,"alpha")
ans = 1x30 logical array
1
1
1
1
0
1
1
1
1
1
0
1
1
1
0
1
1
1
1
1
0
1
1
1
See Also
strcmp | sort | isstrprop | isletter | isspace | eq | ne | gt | ge | le | lt
Related Examples
•
“Text in String and Character Arrays” on page 6-2
•
“Create String Arrays” on page 6-5
•
“Analyze Text Data with String Arrays” on page 6-15
•
“Search and Replace Text” on page 6-37
•
“Test for Empty Strings and Missing Values” on page 6-20
6 Characters and Strings
6-36
