Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make replace with count=0 a no-op #22325

Merged
merged 13 commits into from
Jul 4, 2017
Merged
Prev Previous commit
Next Next commit
document the behavior for negative count
  • Loading branch information
rfourquet committed Jul 4, 2017
commit 5b99e0a770ca87db7b1ce13b4571c37b777decf5
5 changes: 3 additions & 2 deletions base/strings/util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,9 @@ end
"""
replace(string::AbstractString, pat, r[, n::Integer=0])

Search for the given pattern `pat`, and replace each occurrence with `r`. If `n` is
provided, replace at most `n` occurrences. As with search, the second argument may be a
Search for the given pattern `pat`, and replace each occurrence with `r`.
If `n` is provided, replace at most `n` occurrences (if `n < 0`, replace
all occurrences). As with search, the second argument may be a
single character, a vector or a set of characters, a string, or a regular expression. If `r`
is a function, each occurrence is replaced with `r(s)` where `s` is the matched substring.
If `pat` is a regular expression and `r` is a `SubstitutionString`, then capture group
Expand Down