on master help sign in
Merge pull request #767 from mgold/clarify_string_docs
3726aa6Evan Czaplicki
libraries/String.elm+5−4
@@ -71,6 +71,7 @@ concat = Native.String.concat
71{-| Get the length of a string.
71{-| Get the length of a string.
72
72
73 length "innumerable" == 11
73 length "innumerable" == 11
74+ length "" == 0
74
75
75-}
76-}
76length : String -> Int
77length : String -> Int
@@ -254,7 +255,7 @@ any = Native.String.any
254all : (Char -> Bool) -> String -> Bool
255all : (Char -> Bool) -> String -> Bool
255all = Native.String.all
256all = Native.String.all
256
257
257−{-| See if a string contains another one.
258+{-| See if the second string contains the first one.
258
259
259 contains "the" "theory" == True
260 contains "the" "theory" == True
260 contains "hat" "theory" == False
261 contains "hat" "theory" == False
@@ -265,7 +266,7 @@ Use `Regex.contains` if you need something more flexible.
265contains : String -> String -> Bool
266contains : String -> String -> Bool
266contains = Native.String.contains
267contains = Native.String.contains
267
268
268−{-| See if a string starts with another one.
269+{-| See if the second string starts with the first one.
269
270
270 startsWith "the" "theory" == True
271 startsWith "the" "theory" == True
271 startsWith "ory" "theory" == False
272 startsWith "ory" "theory" == False
@@ -273,7 +274,7 @@ contains = Native.String.contains
273startsWith : String -> String -> Bool
274startsWith : String -> String -> Bool
274startsWith = Native.String.startsWith
275startsWith = Native.String.startsWith
275
276
276−{-| See if a string ends with another one.
277+{-| See if the second string ends with the first one.
277
278
278 endsWith "the" "theory" == False
279 endsWith "the" "theory" == False
279 endsWith "ory" "theory" == True
280 endsWith "ory" "theory" == True
@@ -281,7 +282,7 @@ startsWith = Native.String.startsWith
281endsWith : String -> String -> Bool
282endsWith : String -> String -> Bool
282endsWith = Native.String.endsWith
283endsWith = Native.String.endsWith
283
284
284−{-| Get all of the indexes for a substring.
285+{-| Get all of the indexes for a substring in another string.
285
286
286 indexes "i" "Mississippi" == [1,4,7,10]
287 indexes "i" "Mississippi" == [1,4,7,10]
287 indexes "ss" "Mississippi" == [2,5]
288 indexes "ss" "Mississippi" == [2,5]