Reputation: 153
I've made a scanner which reads the file but then I'm confused on how to count the vowels and letters/numbers. I want to use .chartAt(i) in a for loop but you can't use .charAt() in the Scanner class. Curious to see how to go about this problem
Upvotes: 0
Views: 79
Reputation: 425198
This will count alpha numerical:
int alphaNumericCount = input.split("(?<=[A-Za-z0-9])").length - 1;
This will count vowels:
int vowelCount = input.split("(?<=[AEIOUaeiou])").length - 1;
How your read in the file is up to you.
Upvotes: 1