hakyll-4.9.8.0: A static website compiler library

Safe Haskell | None
Language | Haskell98

Hakyll.Core.Util.String

Description

Miscellaneous string manipulation functions.

Synopsis

- trim :: String -> String
- replaceAll :: String -> (String -> String) -> String -> String
- splitAll :: String -> String -> [String]
- needlePrefix :: String -> String -> Maybe String

# Documentation

trim :: String -> String Source #

Trim a string (drop spaces, tabs and newlines at both sides).

replaceAll Source #

Arguments

:: String | Pattern
-> (String -> String) | Replacement (called on capture)
-> String | Source string
-> String | Result

A simple (but inefficient) regex replace funcion

splitAll Source #

Arguments

:: String | Pattern
-> String | String to split
-> [String] | Result

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"