Muhammad Jawwad
Muhammad Jawwad

Reputation: 193

How to get URL and its parameter value in F#

Is there any way to get URL and further its parameter values in f# Only F# any one can help me. I have tried a lot but no solution found

http://www.example.com/blog?blogid=23

Want to get http://www.example.com/blog?blogid=23

Then 23

Upvotes: 1

Views: 1030

Answers (2)

Lee
Lee

Reputation: 144136

let getBlogId uriString =
    let uri = System.Uri(uriString)
    let kvps = HttpUtility.ParseQueryString uri.Query
    let idStr = kvps.["blogid"]
    int idStr

Upvotes: 3

Christian
Christian

Reputation: 7852

let uri = new System.Uri("http://www.example.com/blog?blogid=23")
let blogId = uri.Query.Split('=').[1]

Upvotes: -1

Related Questions