mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
builtin: fix the string.index_any method (#11310)
This commit is contained in:
@ -739,12 +739,12 @@ fn (s string) index_kmp(p string) int {
|
||||
|
||||
// index_any returns the position of any of the characters in the input string - if found.
|
||||
pub fn (s string) index_any(chars string) int {
|
||||
for c in chars {
|
||||
idx := s.index_(c.ascii_str())
|
||||
if idx == -1 {
|
||||
continue
|
||||
for i, ss in s {
|
||||
for c in chars {
|
||||
if c == ss {
|
||||
return i
|
||||
}
|
||||
}
|
||||
return idx
|
||||
}
|
||||
return -1
|
||||
}
|
||||
|
Reference in New Issue
Block a user