1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

examples: use is_letter() method

This commit is contained in:
Robin Martijn 2019-10-22 07:00:28 +02:00 committed by Alexander Medvednikov
parent fdfa564865
commit 03cd34fb54

View File

@ -61,19 +61,13 @@ fn filter_word(word string) string {
return ''
}
mut i := 0
for i < word.len && !is_letter(word[i]) {
for i < word.len && !word[i].is_letter() {
i++
}
start := i
for i < word.len && is_letter(word[i]) {
for i < word.len && word[i].is_letter() {
i++
}
end := i
return word.substr(start, end)
}
// TODO remove once it's possible to call word[i].is_letter()
fn is_letter(c byte) bool {
return c.is_letter()
}