mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
builtin: string.index_after() ?int
This commit is contained in:
parent
85973b9cca
commit
951d30405f
12 changed files with 94 additions and 44 deletions
|
@ -4,11 +4,8 @@ fn main() {
|
|||
html := http.get_text('https://news.ycombinator.com')
|
||||
mut pos := 0
|
||||
for {
|
||||
pos = html.index_after('https://', pos + 1)
|
||||
if pos == -1 {
|
||||
break
|
||||
}
|
||||
end := html.index_after('"', pos)
|
||||
pos = html.index_after('https://', pos + 1) or { break }
|
||||
end := html.index_after('"', pos) or { break }
|
||||
println(html[pos..end])
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue