Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Miscellaneous string manipulation functions.
Documentation
:: String | Pattern |
-> (String -> String) | Replacement (called on match) |
-> String | Source string |
-> String | Result |
A simple (but inefficient) regex replace funcion
A simple regex split function. The resulting list will contain no empty strings.
needlePrefix :: String -> String -> Maybe String Source #
Find the first instance of needle (must be non-empty) in haystack. We return the prefix of haystack before needle is matched.
Examples:
needlePrefix "cd" "abcde" = "ab"
needlePrefix "ab" "abc" = ""
needlePrefix "ab" "xxab" = "xx"
needlePrefix "a" "xx" = "xx"