builtin: string.index_after() ?int

This commit is contained in:
Alexander Medvednikov 2025-03-12 23:02:51 +03:00
parent 85973b9cca
commit 951d30405f
12 changed files with 94 additions and 44 deletions

View file

@ -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])
}
}