fix: bug with "NumberDifferentVowelsInLine"
This commit is contained in:
parent
6ed1429304
commit
691f9153e9
@ -14,9 +14,16 @@ namespace Lab4.K2
|
|||||||
|
|
||||||
public static int NumberDifferentVowelsInLine(string line)
|
public static int NumberDifferentVowelsInLine(string line)
|
||||||
{
|
{
|
||||||
string vowels = "AEIYOUaeiyouĄąĘęĖėĮįŲųŪū";
|
string vowels = "aeiyouąęėįųū";
|
||||||
string pattern = string.Format(@"[{0}]", Regex.Escape(vowels));
|
int count = 0;
|
||||||
return Regex.Matches(line, pattern).Count;
|
|
||||||
|
line = line.ToLower();
|
||||||
|
foreach (char vowel in vowels)
|
||||||
|
{
|
||||||
|
count += line.Contains(vowel) ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: returns words including punctuation after them
|
// Note: returns words including punctuation after them
|
||||||
|
Loading…
Reference in New Issue
Block a user