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

WIP: Iterable string splitting (splititr) #7027

Closed
wants to merge 1 commit into from
Closed

WIP: Iterable string splitting (splititr) #7027

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented May 29, 2014

As per discussion in #6933, an iterator variant of split (and also possibly rsplit) would be useful.

@ghost ghost changed the title WIP: Iterable String Splitting (splititr) WIP: Iterable string splitting (splititr) May 29, 2014
@ghost
Copy link
Author

ghost commented May 29, 2014

This is still WIP, but it supports the basic functionality of split. It uses an immutable iterator object this time and keeps the state separate. Feedback is as always welcome.

  • limit
  • keep_empty
  • run with the full split test suite

I also noticed that split and rsplit lacks Unicode tests, I should probably open a separate PR for this.

immutable SplitItr
str::String
splitter
end
Copy link
Member

Choose a reason for hiding this comment

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

I think this immutable would perform better if it was made parametric

immutable SplitItr{S<:String, T}
    str::S
    splitter::T
end

@ghost
Copy link
Author

ghost commented Jun 11, 2014

@ivarne: Thanks a bundle for the feedback, I have incorporated it into my local repository. I still intend to complete this PR and hope to be able to grab some time this weekend to, my apologies for causing additional messages to go out on the mailing list, do tell me if this was bad style on my part.

@ivarne
Copy link
Member

ivarne commented Jun 11, 2014

It will be great to see this finished, especially if the performance could be good enough to implement split as.

split(...) = collect(splititr(...))

There are lots of posts in the Julia community, and as long as they are "on topic", it is fairly easy for everyone that follows the project to find out if they have anything to contribute on the topic. If you have a question or an opinion, feel free to post. Announcing that you might find time this weekend, is probably not that interesting for everyone to see (especially on a PR that has been silent for 12 days). It is unlikely that someone else will do the job in parallel with you, and because this is performance sensitive code, it will be good to have multiple implementations to test anyway.

@StefanKarpinski
Copy link
Member

I don't mind the reminder, myself. But then, given the amount of Julia email I get, what's one more?

@vtjnash
Copy link
Member

vtjnash commented Jun 26, 2019

Seems like a good addition (sorry for the surprise; I'm looking at really old PR's today). Care to update this to look like the current Base._split method, and then define split(...) = collect(SubString{T}, splititr(...)) as suggested above?

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

Successfully merging this pull request may close these issues.

4 participants