Problem 45245. String count
given a string 'str', count the number of the followings -
- letters
- digits
- white space
- capital letters
- small letters
- punctuation marks
output should be an array y containing the numbers in the same order.
Solution Stats
Problem Comments
-
4 Comments
I get [28 0 9 2 26 7] for test case 2 and [0 13 0 0 0 11] for test case 3.
Tim,
I am not quite sure where did that amp came from in test-2.
it wasn't in my original test suite.
in test-3, grave accent is not a punctuation mark - so far i know.
For some reason, according to Matlab function isstrprop, the characters $ + < = > ^ ` | ~ are not considered to be punctuation marks, or letters, or digits, or anything else--this seems to be discriminatory and unjust.
This problem has an interesting take on punctuation characters.
Solution Comments
Show commentsProblem Recent Solvers19
Suggested Problems
-
Get the area codes from a list of phone numbers
1067 Solvers
-
10580 Solvers
-
Make a random, non-repeating vector.
10506 Solvers
-
Generate a random matrix A of (1,-1)
369 Solvers
-
Find my daddy long leg (No 's')
2596 Solvers
More from this Author174
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!