Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let rec build currentIndex (currentMatch: Match) =
- if currentMatch.Success then
- let variableToReplace = currentMatch.Groups.[0]
- let length = variableToReplace.Index - currentIndex
- let subUrl = url.Substring(currentIndex, length)
- builder.Append(subUrl) |> ignore
- let replaceWith =
- match currentMatch.Groups.[1].Value with
- | "INT" -> "INTEGER" // replace with int generator
- | _ -> "OBJECT" // optionally other data types
- builder.Append(replaceWith) |> ignore
- build (subUrl.Length + variableToReplace.Length) (currentMatch.NextMatch())
- else
- builder.ToString()
- build 0 (variableRegex.Match(url))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement