我正在努力学习 F#
我想做的是下载一个网页,将其拆分为一个序列,然后找到一个项目的索引并在它之后获取接下来的 3 个项目。
这是代码-有人可以告诉我我做错了什么吗?
let find = "<head>"
let page = downloadUrl("http://www.stackoverflow.com")
let lines = seq ( page.Replace("\r", System.String.Empty).Split([|"\n"|], StringSplitOptions.RemoveEmptyEntries) )
let pos = lines |> Seq.findIndex(fun a -> a == find) // getting a Exception of type 'System.Collections.Generic.KeyNotFoundException' was thrown.
let result = // now to get the next 3 items
printfn "%A" (Seq.toList result);;