let searchInString str pat = let mutable i = 0 let mutable j = 0 let strLen = String . length str let patLen = String . length pat while i <= ( strLen - patLen ) && j < patLen do if str .[ i + j ] = pat .[ j ] then j <- j + 1 else i <- i + 1 ; j <- 0 ; if i <= ( strLen - patLen ) then Some i else None let s = "My name is Anonymous." let f = searchInString s " is" match f with | Some v -> printfn "%c %i" ( s .[ v ]) v | None -> printfn "pat not found"
t.me/perfect0sight