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

Try to clarify split docs #26634

Merged
merged 2 commits into from
Mar 28, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions base/strings/util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -239,17 +239,20 @@ function rpad(
end

"""
split(s::AbstractString, [chars]; limit::Integer=0, keep::Bool=true)
split(s::AbstractString; limit::Integer=0, keep::Bool=false)
split(s::AbstractString, chars; limit::Integer=0, keep::Bool=true)

Return an array of substrings by splitting the given string on occurrences of the given
character delimiters, which may be specified in any of the formats allowed by
[`findnext`](@ref)'s first argument (i.e. as a string, regular expression or a function),
or as a single character or collection of characters.

If `chars` is omitted, it defaults to the set of all space characters, and
`keep` is taken to be `false`. The two keyword arguments are optional: they are a
maximum size for the result and a flag determining whether empty fields should be kept in
the result.
If `chars` is omitted, it defaults to the set of all space characters.

The optional keyword arguments are:
- `limit`: the maximum size of the result. `limit=0` implies no maximum (default)
- `keep`: whether empty fields should be kept in the result. Default is `false` without
a `chars` argument, `true` with a `chars` argument.

# Examples
```jldoctest
Expand Down