題目說明:
函式帶入字串判斷有幾個母音(a,e,i,o,u)
code
export class Kata {
static getCount(str: string): number {
//code
const lowerCaseStr = str.trim().toLowerCase();
const regex = /[aeiou]/g;
const matches = lowerCaseStr.match(regex);
if (matches) {
return matches.length;
} else {
return 0;
}
}
}

![[筆記] 最重要的小事:輸入範圍](https://static.coderbridge.com/images/covers/default-post-cover-2.jpg)
![[Kotlin]擺脫靜態公用程式類別:頂層函式和屬性](https://static.coderbridge.com/images/covers/default-post-cover-3.jpg)