Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/Data/String.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ stripPrefix :: String -> String -> Maybe String

If the string starts with the given prefix, return the portion of the
string left after removing it, as a Just value. Otherwise, return Nothing.
* `stripPrefix "http:" "http://purescript.org" == Just "//purescript.org"
* `stripPrefix "http:" "https://purescript.org" == Nothing
* `stripPrefix "http:" "http://purescript.org" == Just "//purescript.org"`
* `stripPrefix "http:" "https://purescript.org" == Nothing`

#### `fromCharArray`

Expand Down Expand Up @@ -131,7 +131,7 @@ lastIndexOf :: String -> String -> Maybe Int
```

Returns the index of the last occurrence of the first string in the
second string. Returns `-1` if there is no match.
second string. Returns `Nothing` if there is no match.

#### `lastIndexOf'`

Expand Down
6 changes: 3 additions & 3 deletions src/Data/String.purs
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ dropWhile p s = drop (count p s) s

-- | If the string starts with the given prefix, return the portion of the
-- | string left after removing it, as a Just value. Otherwise, return Nothing.
-- | * `stripPrefix "http:" "http://purescript.org" == Just "//purescript.org"
-- | * `stripPrefix "http:" "https://purescript.org" == Nothing
-- | * `stripPrefix "http:" "http://purescript.org" == Just "//purescript.org"`
-- | * `stripPrefix "http:" "https://purescript.org" == Nothing`
stripPrefix :: String -> String -> Maybe String
stripPrefix prefix str =
case indexOf prefix str of
Expand Down Expand Up @@ -137,7 +137,7 @@ foreign import _indexOf' :: (forall a. a -> Maybe a)
-> Maybe Int

-- | Returns the index of the last occurrence of the first string in the
-- | second string. Returns `-1` if there is no match.
-- | second string. Returns `Nothing` if there is no match.
lastIndexOf :: String -> String -> Maybe Int
lastIndexOf = _lastIndexOf Just Nothing

Expand Down