examples: use is_letter() method
parent
fdfa564865
commit
03cd34fb54
|
@ -61,19 +61,13 @@ fn filter_word(word string) string {
|
||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
mut i := 0
|
mut i := 0
|
||||||
for i < word.len && !is_letter(word[i]) {
|
for i < word.len && !word[i].is_letter() {
|
||||||
i++
|
i++
|
||||||
}
|
}
|
||||||
start := i
|
start := i
|
||||||
for i < word.len && is_letter(word[i]) {
|
for i < word.len && word[i].is_letter() {
|
||||||
i++
|
i++
|
||||||
}
|
}
|
||||||
end := i
|
end := i
|
||||||
return word.substr(start, end)
|
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()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue