Skip to content

Commit 9b63fd9

Browse files
authored
improve docs of replace(::String) with multiple replacements (#57683)
addresses: #57669 (comment)
1 parent 998fff5 commit 9b63fd9

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

base/strings/util.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,8 +1073,11 @@ is supplied, the transformed string is instead written to `io` (returning `io`).
10731073
(For example, this can be used in conjunction with an [`IOBuffer`](@ref) to re-use
10741074
a pre-allocated buffer array in-place.)
10751075
1076-
Multiple patterns can be specified, and they will be applied left-to-right
1077-
simultaneously, so only one pattern will be applied to any character, and the
1076+
Multiple patterns can be specified: The input string will be scanned only once
1077+
from start (left) to end (right), and the first matching replacement
1078+
will be applied to each substring. Replacements are applied in the order of
1079+
the arguments provided if they match substrings starting at the same
1080+
input string position. Thus, only one pattern will be applied to any character, and the
10781081
patterns will only be applied to the input text, not the replacements.
10791082
10801083
!!! compat "Julia 1.7"

0 commit comments

Comments
 (0)