RosettaCodeData/Task/Binary-strings/Haskell/binary-strings-7.hs
Ingy döt Net 86c034bb8b new files
2013-04-10 12:38:42 -07:00

5 lines
265 B
Haskell

{- Much thanks to brool.com for this nice
and elegant solution. Using an imported standard library
(Text.Regex), replace a given substring with another -}
strReplace :: String -> String -> String -> String
strReplace old new orig = subRegex (mkRegex old) orig new