take -package:base package:text

O(n) take n, applied to a Text, returns the prefix of the Text of length n, or the Text itself if n is greater than the length of the Text.
O(n) take n, applied to a stream, returns the prefix of the stream of length n, or the stream itself if n is greater than the length of the stream. Properties
unstream . take n . stream = take n
O(n) take n, applied to a Text, returns the prefix of the Text of length n, or the Text itself if n is greater than the length of the Text.
O(n) takeEnd n t returns the suffix remaining after taking n characters from the end of t. Examples:
>>> takeEnd 3 "foobar"
"bar"
O(n) takeWhile, applied to a predicate p and a Text, returns the longest prefix (possibly empty) of elements that satisfy p.
O(n) takeWhileEnd, applied to a predicate p and a Text, returns the longest suffix (possibly empty) of elements that satisfy p. Examples:
>>> takeWhileEnd (=='o') "foo"
"oo"
O(1) Return the prefix of the Text of n Word8 units in length. If n would cause the Text to end inside a code point, the end of the prefix will be advanced by several additional Word8 units to maintain its validity.
takeWhile, applied to a predicate p and a stream, returns the longest prefix (possibly empty) of elements that satisfy p. Properties
unstream . takeWhile p . stream = takeWhile p
O(n) takeEnd n t returns the suffix remaining after taking n characters from the end of t. Examples:
takeEnd 3 "foobar" == "bar"
O(n) takeWhileEnd, applied to a predicate p and a Text, returns the longest suffix (possibly empty) of elements that satisfy p. Examples:
takeWhileEnd (=='o') "foo" == "oo"
O(1) Unchecked take of k Word8s from the front of a Text.