RosettaCodeData/Task/Binary-strings/Haskell/binary-strings-7.hs

6 lines
265 B
Haskell
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
{- 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