-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Open
Labels
good first issueIndicates a good issue for first-time contributors to JuliaIndicates a good issue for first-time contributors to Juliahelp wantedIndicates that a maintainer wants help on an issue or pull requestIndicates that a maintainer wants help on an issue or pull requeststrings"Strings!""Strings!"
Description
The replace function allows a string, an s"..." replacement specifier or a function as its third argument. For the sake of do syntax, it might make sense to support the function as the first argument, like so:
julia> replace("Hello, world.", r"\w+") do word
n = 0
for c in word
n += lowercase(c) in "aeiou"
end
return n
end
"2, 1."If someone decides to do this, while they're at it, an explanation of replacement patterns – i.e. s"..." strings and some more examples in the replace docs wouldn't hurt. E.g.:
julia> replace("Hello, world.", r"(\w+)(\W+)(\w+)", s"\3\2\1")
"world, Hello."stevengj, ararslan, oxinabox, nalimilan and vancleve
Metadata
Metadata
Assignees
Labels
good first issueIndicates a good issue for first-time contributors to JuliaIndicates a good issue for first-time contributors to Juliahelp wantedIndicates that a maintainer wants help on an issue or pull requestIndicates that a maintainer wants help on an issue or pull requeststrings"Strings!""Strings!"