mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-07 01:35:16 +08:00
Formatted with Google Java Formatter
This commit is contained in:
@ -1,8 +1,8 @@
|
|||||||
package strings;
|
package strings;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Vowel Count is a system whereby character strings are placed in order based on the
|
* Vowel Count is a system whereby character strings are placed in order based on the position of
|
||||||
* position of the characters in the conventional ordering of an alphabet. Wikipedia:
|
* the characters in the conventional ordering of an alphabet. Wikipedia:
|
||||||
* https://en.wikipedia.org/wiki/Alphabetical_order
|
* https://en.wikipedia.org/wiki/Alphabetical_order
|
||||||
*/
|
*/
|
||||||
class CheckVowels {
|
class CheckVowels {
|
||||||
@ -30,15 +30,18 @@ class CheckVowels{
|
|||||||
/**
|
/**
|
||||||
* count the number of vowels
|
* count the number of vowels
|
||||||
*
|
*
|
||||||
* @param input a string
|
* @param input a string prints the count of vowels
|
||||||
* prints the count of vowels
|
|
||||||
*/
|
*/
|
||||||
public static void countVowels(String input) {
|
public static void countVowels(String input) {
|
||||||
input.toLowerCase();
|
input.toLowerCase();
|
||||||
int count = 0;
|
int count = 0;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (i < input.length()) {
|
while (i < input.length()) {
|
||||||
if(input.charAt(i)=='a' || input.charAt(i)=='e'||input.charAt(i)=='i'||input.charAt(i)=='o'||input.charAt(i)=='u' ){
|
if (input.charAt(i) == 'a'
|
||||||
|
|| input.charAt(i) == 'e'
|
||||||
|
|| input.charAt(i) == 'i'
|
||||||
|
|| input.charAt(i) == 'o'
|
||||||
|
|| input.charAt(i) == 'u') {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
|
Reference in New Issue
Block a user