Skip to content

Commit

Permalink
doc: improve docstring of eachsplit (#43745)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobnissen authored Feb 12, 2022
1 parent f6aab71 commit aad5c1c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
12 changes: 7 additions & 5 deletions base/strings/util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -479,8 +479,8 @@ function rpad(
end

"""
eachsplit(str::AbstractString, dlm; limit::Integer=0)
eachsplit(str::AbstractString; limit::Integer=0)
eachsplit(str::AbstractString, dlm; limit::Integer=0, keepempty::Bool=true)
eachsplit(str::AbstractString; limit::Integer=0, keepempty::Bool=false)
Split `str` on occurrences of the delimiter(s) `dlm` and return an iterator over the
substrings. `dlm` can be any of the formats allowed by [`findnext`](@ref)'s first argument
Expand All @@ -489,8 +489,10 @@ of characters.
If `dlm` is omitted, it defaults to [`isspace`](@ref).
The iterator will return a maximum of `limit` results if the keyword argument is supplied.
The default of `limit=0` implies no maximum.
The optional keyword arguments are:
- `limit`: the maximum size of the result. `limit=0` implies no maximum (default)
- `keepempty`: whether empty fields should be kept in the result. Default is `false` without
a `dlm` argument, `true` with a `dlm` argument.
See also [`split`](@ref).
Expand Down Expand Up @@ -574,7 +576,7 @@ The optional keyword arguments are:
- `keepempty`: whether empty fields should be kept in the result. Default is `false` without
a `dlm` argument, `true` with a `dlm` argument.
See also [`rsplit`](@ref).
See also [`rsplit`](@ref), [`eachsplit`](@ref).
# Examples
```jldoctest
Expand Down
1 change: 1 addition & 0 deletions doc/src/base/strings.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Base.findprev(::AbstractString, ::AbstractString, ::Integer)
Base.occursin
Base.reverse(::Union{String,SubString{String}})
Base.replace(s::AbstractString, ::Pair...)
Base.eachsplit
Base.split
Base.rsplit
Base.strip
Expand Down

0 comments on commit aad5c1c

Please sign in to comment.