taesik

return the number of vowels 본문

functions and trick/RUST

return the number of vowels

taesikk 2022. 6. 9. 16:37

 

 

 

fn get_count(string: &str) -> usize {
    string.matches(|x| match x {'a'|'e'|'i'|'o'|'u' => true, _ => false}).count()
}

 

'functions and trick > RUST' 카테고리의 다른 글

Masking with # except last 4 string  (0) 2022.06.09
Break camelCase  (0) 2022.06.06
Largest 5 digit number in a series  (0) 2022.06.06