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

split using isspace #27252

Merged
merged 1 commit into from
May 28, 2018
Merged

split using isspace #27252

merged 1 commit into from
May 28, 2018

Conversation

simonbyrne
Copy link
Contributor

Similar to #27232, this tweaks split to use isspace instead of just unicode delimiters.

@simonbyrne simonbyrne added the domain:strings "Strings!" label May 24, 2018
@fredrikekre
Copy link
Member

Can we change the argument order in a non-breaking way? split(isspace, str) seems more natural.

@simonbyrne
Copy link
Contributor Author

Not in this case, since split(::String, ::String) is valid.

@simonbyrne
Copy link
Contributor Author

simonbyrne commented May 24, 2018

If we merge both PRs, then _default_delims will only then be used in

julia/base/shell.jl

Lines 7 to 16 in 779cf84

# strips the end but respects the space when the string ends with "\\ "
function rstrip_shell(s::AbstractString)
c_old = nothing
for (i, c) in Iterators.reverse(pairs(s))
((c == '\\') && c_old == ' ') && return SubString(s, 1, i+1)
c in _default_delims || return SubString(s, 1, i)
c_old = c
end
SubString(s, 1, 0)
end

@simonbyrne
Copy link
Contributor Author

Changing the ordering would match findXX methods, but would be different from join.

@ViralBShah
Copy link
Member

Rebased on master.

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.
Split `str` into an array of substrings on occurences of the delimiter `dlm`. `dlm`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"occurrences". Could also say "delimiter(s)".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:strings "Strings!"
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants