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

use Char replacement function for Charpattern #25815

Merged
merged 5 commits into from Feb 22, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion NEWS.md
Expand Up @@ -196,6 +196,11 @@ Breaking changes

This section lists changes that do not have deprecation warnings.

* `replace(s::AbstractString, pat=>repl)` if repl is a function, now calls
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't clear about what the change was. Maybe:

`replace(s::AbstractString, pat=>repl)` for function `repl` arguments formerly passed a substring
to `repl` in all cases.  It now passes substrings for string patterns `pat`, but a `Char`
for character patterns (when `pat` is a `Char`, collection of `Char`, or a character predicate).

`repl(s[pos]::Char)`, when pat is a `Char` or collection of `Char` or predicate,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems easier to just say now calls repl(c) for each matched character c::Char, instead of a substring as it did previously. No need to define pos, and it would be clearer to say what the old behavior was.

to determine the replacement of a single character. `pos` is the index of the
matched character.

* `readuntil` now does *not* include the delimiter in its result, matching the
behavior of `readline`. Pass `keep=true` to get the old behavior ([#25633]).

Expand Down Expand Up @@ -1260,4 +1265,4 @@ Command-line option changes
[#25622]: https://github.com/JuliaLang/julia/issues/25622
[#25634]: https://github.com/JuliaLang/julia/issues/25634
[#25654]: https://github.com/JuliaLang/julia/issues/25654
[#25655]: https://github.com/JuliaLang/julia/issues/25655
[#25655]: https://github.com/JuliaLang/julia/issues/25655