Quote (Whalefood @ Sep 28 2015 06:44pm)
How would I do this? I need to find the number of uppercase I and lowercase i from a sentence input by the user.
Then it is even simpler.
Using the code labatymo provided you can modify it to do what you need:
Code
String test = "Some String";
int upperCaseCount = 0;
int lowerCaseCount = 0;
for ( char c : test.toCharArray( ) ) {
if ( c == 'I') {
upperCaseCount++;
}
else if(c == 'i'){
lowerCaseCount++;
}
}