**split**

*O(n)* Splits a Text into components delimited by separators, The resulting components do not contain the separators. Two adjacent separators result in an empty component in the output. eg.
> split (=='a') "aabbaca" == ["","","bb","c",""]
> split (=='a') "" == [""]
*O(n)* Splits a Text into components delimited by separators, The resulting components do not contain the separators. Two adjacent separators result in an empty component in the output. eg.
> split (=='a') "aabbaca" == ["","","bb","c",""]
> split (=='a') [] == [""]
*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" == ["",""]
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" == ["",""]
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(min(n,W))*. The expression (split k map) is a pair (map1,map2) than k and all keys in map2 larger than k. Any key equal to k is found in neither map1 nor map2.
> split 2 (fromList [(5,"a"), (3,"b")]) == (empty, fromList [(3,"b"), (5,"a")])
> split 3 (fromList [(5,"a"), (3,"b")]) == (empty, singleton 5 "a")
> split 4 (fromList [(5,"a"), (3,"b")]) == (singleton 3 "b", singleton 5 "a")
> split 5 (fromList [(5,"a"), (3,"b")]) == (singleton 3 "b", empty)
> split 6 (fromList [(5,"a"), (3,"b")]) == (fromList [(3,"b"), (5,"a")], empty)
*O(min(n,W))*. The expression (split x set) is a pair (set1,set2) of set less than x and set2 comprises the elements of set greater than x.
> split 3 (fromList [1..5]) == (fromList [1,2], fromList [4,5])
*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" == ["",""]
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(log n)*. The expression (split x set) is a pair (set1,set2) of set less than x and set2 comprises the elements of set greater than x.
*O(log n)*. The expression (split k map) is a pair (map1,map2) than k and the keys in map2 larger than k. Any key equal to k is found in neither map1 nor map2.
> split 2 (fromList [(5,"a"), (3,"b")]) == (empty, fromList [(3,"b"), (5,"a")])
> split 3 (fromList [(5,"a"), (3,"b")]) == (empty, singleton 5 "a")
> split 4 (fromList [(5,"a"), (3,"b")]) == (singleton 3 "b", singleton 5 "a")
> split 5 (fromList [(5,"a"), (3,"b")]) == (singleton 3 "b", empty)
> split 6 (fromList [(5,"a"), (3,"b")]) == (fromList [(3,"b"), (5,"a")], empty)
A collection of various methods for splitting lists into parts, akin to the "split" function found in several mainstream languages. Here is its tale:
Once upon a time the standard Data.List module held no function for splitting a list into parts according to a delimiter. Many a brave lambda-knight strove to add such a function, but their striving was in vain, for Lo, the Supreme Council fell to bickering amongst themselves what was to be the essential nature of the One True Function which could cleave a list in twain (or thrain, or any required number of parts).
And thus came to pass the split package, comprising divers functions for splitting a list asunder, each according to its nature. And the Supreme Council had no longer any grounds for argument, for the favored method of each was contained therein.
To get started, see the Data.List.Split module.
Version 0.2.2
splitAt n xs returns a tuple xs prefix of length n and second element is the remainder of the list:
> splitAt 6 "Hello World!" == ("Hello ","World!")
> splitAt 3 [1,2,3,4,5] == ([1,2,3],[4,5])
> splitAt 1 [1,2,3] == ([1],[2,3])
> splitAt 3 [1,2,3] == ([1,2,3],[])
> splitAt 4 [1,2,3] == ([1,2,3],[])
> splitAt 0 [1,2,3] == ([],[1,2,3])
> splitAt (-1) [1,2,3] == ([],[1,2,3])
It is equivalent to (take n xs, drop n xs). splitAt is an instance of the more general Data.List.genericSplitAt, in which n may be of any integral type.
Splits a type constructor application

This module splits Control.Concurrent.Chan into sending and receiving halves, which allows the type system to more finely constrain program behavior. As a secondary benefit, messages written to channels with no receive ports associated with them can be reliably garbage collected.
In addition, this module incorporates several of clean-ups and additions to the venerable Chan. Most notably, the deprecated thread-unsafe functions have been removed, the ability to duplicate Receive Ports has been added, the sendMany operation allows for multiple messages to be sent atomically, and the split operation turns a single channel into two.
Version 0.2.0.1

Split a big audio file into pieces at positions of silence
Version 0.1.1

*O(log(min(i,n-i)))*. Split a sequence at a given position. splitAt i s = (take i s, drop i s).
*O(n)* splitAt n t returns a pair whose first element is a prefix of t of length n, and whose second is the remainder of the string. It is equivalent to (take n t, drop n t).
Show more results