File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -217,6 +217,17 @@ singletonFallback (CodePoint cp) =
217217-- | Splits a string into two substrings, where `before` contains the code
218218-- | points up to (but not including) the given index, and `after` contains the
219219-- | rest of the string, from that index on.
220+ -- |
221+ -- | Thus the length of `(splitAt i s).before` will equal either `i` or
222+ -- | `length s`, if that is shorter. (Or if `i` is negative the length will be
223+ -- | 0.)
224+ -- |
225+ -- | In code:
226+ -- | ```purescript
227+ -- | length (splitAt i s).before == min (max i 0) (length s)
228+ -- | (splitAt i s).before <> (splitAt i s).after == s
229+ -- | splitAt i s == {before: take i s, after: drop i s}
230+ -- | ```
220231splitAt :: Int -> String -> { before :: String , after :: String }
221232splitAt i s =
222233 let before = take i s in
You can’t perform that action at this time.
0 commit comments