Skip to content

Commit 268ecda

Browse files
Consistency
1 parent d69ea5f commit 268ecda

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/Data/String.purs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,9 @@ foreign import count :: (Char -> Boolean) -> String -> Int
231231
-- | * `split (Pattern " ") "hello world" == ["hello", "world"]`
232232
foreign import split :: Pattern -> String -> Array String
233233

234-
-- | Returns a string split into two substrings at the given index, where
235-
-- | `before` includes all of the characters up to (but not including) the
236-
-- | given index, and `after` is the rest of the string, from the given index
237-
-- | on.
234+
-- | Splits a string into two substrings, where `before` contains the
235+
-- | characters up to (but not including) the given index, and `after` contains
236+
-- | the rest of the string, from that index on.
238237
-- |
239238
-- | Thus the length of `(splitAt i s).before` will equal either `i` or
240239
-- | `length s`, if that is shorter. (Or if `i` is negative the length will be
@@ -244,6 +243,7 @@ foreign import split :: Pattern -> String -> Array String
244243
-- | ```purescript
245244
-- | length (splitAt i s).before == min (max i 0) (length s)
246245
-- | (splitAt i s).before <> (splitAt i s).after == s
246+
-- | splitAt i s == {before: take i s, after: drop i s}
247247
-- | ```
248248
foreign import splitAt :: Int -> String -> { before :: String, after :: String }
249249

test/Test/Data/String.purs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,12 +165,12 @@ testString = do
165165
{ before, after } ->
166166
r.before == before && r.after == after
167167

168-
testSplitAt 1 "" { before: "", after: "" }
169-
testSplitAt 0 "a" { before: "", after: "a" }
170-
testSplitAt 1 "a" { before: "a", after: "" }
171-
testSplitAt 1 "ab" { before: "a", after: "b" }
172-
testSplitAt 3 "aabcc" { before: "aab", after: "cc" }
173-
testSplitAt (-1) "abc" { before: "", after: "abc" }
168+
testSplitAt 1 "" {before: "", after: ""}
169+
testSplitAt 0 "a" {before: "", after: "a"}
170+
testSplitAt 1 "a" {before: "a", after: ""}
171+
testSplitAt 1 "ab" {before: "a", after: "b"}
172+
testSplitAt 3 "aabcc" {before: "aab", after: "cc"}
173+
testSplitAt (-1) "abc" {before: "", after: "abc"}
174174

175175
log "toCharArray"
176176
assert $ toCharArray "" == []

0 commit comments

Comments
 (0)