Selectively replace multiple instances of a character within a string: Difference between revisions
Content added Content deleted
Line 197: | Line 197: | ||
case M.lookup c a of |
case M.lookup c a of |
||
Nothing -> (a, c) |
Nothing -> (a, c) |
||
Just |
Just [] -> (a, c) |
||
Just (d : ds) -> |
|||
( M.insert c ds a, |
|||
fromMaybe c d |
|||
) |
|||
fromMaybe c (head ds) |
|||
) |
|||
--------------------------- TEST ------------------------- |
--------------------------- TEST ------------------------- |