Remove yield not required by F# 4.7

This commit is contained in:
Daniel J. Summers
2019-09-23 20:40:47 -05:00
parent 4dbd58fb92
commit bf48c360de
10 changed files with 252 additions and 261 deletions

View File

@@ -30,17 +30,15 @@ module String =
/// string.Replace()
let replace (find : string) repl (str : string) = str.Replace (find, repl)
/// Replace the first occurrence of a string with a second string within a given string
let replaceFirst (needle : string) replacement (haystack : string) =
match haystack.IndexOf needle with
| -1 -> haystack
| idx ->
seq {
yield haystack.[0..idx - 1]
yield replacement
yield haystack.[idx + needle.Length..]
}
[ haystack.[0..idx - 1]
replacement
haystack.[idx + needle.Length..]
]
|> String.concat ""