Merge: lib/core: introduce replace_first in text/string_search
authorJean Privat <jean@pryen.org>
Tue, 6 Jun 2017 16:01:39 +0000 (12:01 -0400)
committerJean Privat <jean@pryen.org>
Tue, 6 Jun 2017 16:01:39 +0000 (12:01 -0400)
commitf8ee28e3fc8ecc8ff2e52b989782d487e79e443b
treef35e888c4033f39fdced8ad3a112bd61c47a8054
parentf9969fb1118e7a60fd92f2d62a52309312ded6aa
parentda2b9e52c61cd6df4bbefc8b5711af4c43610f7b
Merge: lib/core: introduce replace_first in text/string_search

Replace the first occurrence of `pattern` with `string`

~~~nit
assert "hlelo".replace_first("le", "el") == "hello"
assert "hello".replace_first('l', "")    == "helo"
~~~

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

Pull-Request: #2475