Z-Data-0.8.3.0: Array, vector and text
Copyright(c) Dong Han 2017-2018
LicenseBSD
Maintainerwinterland1989@gmail.com
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Z.Data.Text.Search

Description

 
Synopsis

element-wise search

elem :: Char -> Text -> Bool Source #

O(n) elem test if given char is in given text.

notElem :: Char -> Text -> Bool Source #

O(n) not . elem

Searching by equality

findIndices :: (Char -> Bool) -> Text -> [Int] Source #

find all char index matching the predicate.

findBytesIndices :: (Char -> Bool) -> Text -> [Int] Source #

find all char's byte index matching the predicate.

find Source #

Arguments

:: (Char -> Bool) 
-> Text 
-> (Int, Maybe Char)

(char index, matching char)

O(n) find the first char matching the predicate in a text from left to right, if there isn't one, return the text length.

findR Source #

Arguments

:: (Char -> Bool) 
-> Text 
-> (Int, Maybe Char)

(char index(counting backwards), matching char)

O(n) find the first char matching the predicate in a text from right to left.

findIndex :: (Char -> Bool) -> Text -> Int Source #

O(n) find the char index.

findIndexR :: (Char -> Bool) -> Text -> Int Source #

O(n) find the char index in reverse order.

findBytesIndex :: (Char -> Bool) -> Text -> Int Source #

O(n) find the char's byte slice index.

findBytesIndexR :: (Char -> Bool) -> Text -> Int Source #

O(n) find the char's byte slice index in reverse order(pointing to the right char's first byte).

filter :: (Char -> Bool) -> Text -> Text Source #

O(n) filter, applied to a predicate and a text, returns a text containing those chars that satisfy the predicate.

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

O(n) The partition function takes a predicate, a text, returns a pair of text with codepoints which do and do not satisfy the predicate, respectively; i.e.,

partition p txt == (filter p txt, filter (not . p) txt)