Mikan
Safe HaskellNone
LanguageHaskell2010

Mikan.Utils.Text

Contents

Description

Utilities for working with Text

Synopsis

Substrings

breakAfter :: (Char -> Bool) -> Text -> (Text, Text) Source #

Breaks a bit of text just after a character satisfying the predicate is found.

Examples

Expand
>>> breakAfter (== 'b') "aaaabbbb"
("aaaab","bbb")
>>> breakAfter (== 'a') "aaaabbbb"
("a","aaabbbb")
>>> breakAfter (== 'c') "aaaabbbb"
("aaaabbbb","")

spanEnd :: (Char -> Bool) -> Text -> (Text, Text) Source #

spanEnd, applied to a predicate p, a text t, returns a pair (t1, t2) where t2 is the longest suffix of t whose elements satisfy p, and t1 is the remainder of the text.