split package:bytestring

O(n) Break a ByteString into pieces separated by the byte argument, consuming the delimiter. I.e.
split 10  "a\nb\nd\ne" == ["a","b","d","e"]   -- fromEnum '\n' == 10
split 97  "aXaXaXa"    == ["","X","X","X",""] -- fromEnum 'a' == 97
split 120 "x"          == ["",""]             -- fromEnum 'x' == 120
split undefined ""     == []                  -- and not [""]
and
intercalate [c] . split c == id
split == splitWith . (==)
As for all splitting functions in this library, this function does not copy the substrings, it just constructs new ByteStrings that are slices of the original.
O(n) Break a ByteString into pieces separated by the byte argument, consuming the delimiter. I.e.
split '\n' "a\nb\nd\ne" == ["a","b","d","e"]
split 'a'  "aXaXaXa"    == ["","X","X","X",""]
split 'x'  "x"          == ["",""]
split undefined ""      == []  -- and not [""]
and
intercalate [c] . split c == id
split == splitWith . (==)
As for all splitting functions in this library, this function does not copy the substrings, it just constructs new ByteStrings that are slices of the original.
O(n) Break a ByteString into pieces separated by the byte argument, consuming the delimiter. I.e.
split '\n' "a\nb\nd\ne" == ["a","b","d","e"]
split 'a'  "aXaXaXa"    == ["","X","X","X"]
split 'x'  "x"          == ["",""]
split undefined ""      == []  -- and not [""]
and
intercalate [c] . split c == id
split == splitWith . (==)
As for all splitting functions in this library, this function does not copy the substrings, it just constructs new ByteStrings that are slices of the original.
O(n) Break a ShortByteString into pieces separated by the byte argument, consuming the delimiter. I.e.
split 10  "a\nb\nd\ne" == ["a","b","d","e"]   -- fromEnum '\n' == 10
split 97  "aXaXaXa"    == ["","X","X","X",""] -- fromEnum 'a' == 97
split 120 "x"          == ["",""]             -- fromEnum 'x' == 120
split undefined ""     == []                  -- and not [""]
and
intercalate [c] . split c == id
split == splitWith . (==)
Note: copies the substrings
O(1) splitAt n xs is equivalent to (take n xs, drop n xs).
O(n) Splits a ByteString into components delimited by separators, where the predicate returns True for a separator element. The resulting components do not contain the separators. Two adjacent separators result in an empty component in the output. eg.
splitWith (==97) "aabbaca" == ["","","bb","c",""] -- fromEnum 'a' == 97
splitWith undefined ""     == []                  -- and not [""]
O(n) Splits a ByteString into components delimited by separators, where the predicate returns True for a separator element. The resulting components do not contain the separators. Two adjacent separators result in an empty component in the output. eg.
splitWith (=='a') "aabbaca" == ["","","bb","c",""]
splitWith undefined ""      == []  -- and not [""]
O(n/c) splitAt n xs is equivalent to (take n xs, drop n xs).
O(n) splitAt n sbs is equivalent to (take n sbs, drop n sbs). Note: copies the substrings
O(n) Splits a ShortByteString into components delimited by separators, where the predicate returns True for a separator element. The resulting components do not contain the separators. Two adjacent separators result in an empty component in the output. eg.
splitWith (==97) "aabbaca" == ["","","bb","c",""] -- fromEnum 'a' == 97
splitWith undefined ""     == []                  -- and not [""]