From 67600ce603817410d87bc91f26390702a21bed02 Mon Sep 17 00:00:00 2001 From: Simon Byrne Date: Tue, 27 Mar 2018 11:59:14 -0700 Subject: [PATCH 1/2] Try to clarify `split` docs The description of the options was confusing. We might also want change the `keep` option to something more descriptive, like `keepempty` --- base/strings/util.jl | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/base/strings/util.jl b/base/strings/util.jl index 81d838b665f1c..1b5f7667c7456 100644 --- a/base/strings/util.jl +++ b/base/strings/util.jl @@ -239,6 +239,7 @@ function rpad( end """ + 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 @@ -246,10 +247,12 @@ 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 + `chars` argument, `true` with `chars. # Examples ```jldoctest From d9af9195b5e4141a53f44abc911dcaec56f7eae1 Mon Sep 17 00:00:00 2001 From: Simon Byrne Date: Wed, 28 Mar 2018 10:06:01 -0700 Subject: [PATCH 2/2] Address comments --- base/strings/util.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/base/strings/util.jl b/base/strings/util.jl index 1b5f7667c7456..613d9767eb92d 100644 --- a/base/strings/util.jl +++ b/base/strings/util.jl @@ -240,7 +240,7 @@ end """ split(s::AbstractString; limit::Integer=0, keep::Bool=false) - split(s::AbstractString, [chars]; limit::Integer=0, keep::Bool=true) + 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 @@ -252,7 +252,7 @@ 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 - `chars` argument, `true` with `chars. + a `chars` argument, `true` with a `chars` argument. # Examples ```jldoctest