Accept a string as parameter find out how many consonants present in it??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Accept a string as parameter find out how many consonants present in it???

need to find consonant

8th May 2017, 6:37 AM
Mohan
Mohan - avatar
1 Answer
+ 2
are you talking about no of constant. String vowel = "aeiou"; public int constantslen(String input){ string tmp = input; for(int i=0; i<vowel.length();i++){ char ch = vowel.charAt(i); tmp = tmp.replace(ch,'\0'); ch = Character.toUpperCase(ch); tmp = tmp.replace(ch,'\0'); } return tmp.length(); }
8th May 2017, 7:04 AM
MR Programmer
MR Programmer - avatar