3 ms·
Exactly. We're still waiting for string split/join.
by zerr 7y ago
Exactly. We're still waiting for string split/join.
- IshKebab 7y agoYeah, kind of blows my mind how many advanced features they add, but basic string handling stuff that you always use (split, join, startsWith, etc.) is never added.
- pjmlp 7y agoWell, it is a matter of who is willing to submit a paper and champion the idea. I think the problem is that those features are an uphill battle with the crowd that wants performance above anything else, given the implicit allocations that they might need.
- thestoicattack 7y agoFor the record, std::string::starts_with and ends_with are in C++20. Split and join aren't, though. (I think join is not too tough to write, but I don't really know how you'd write split in a generic enough way for everyone to be satisfied.)
- ryanianian 7y agoJoin is relatively trivial using std::stringstream. I'm optimistic that split will be less contentious with C++20 ranges since you can just range-based-for loop over the split tokens in-place and/or collect them into a container using range mechanisms : best of both worlds.
- alexhutcheson 7y agoabsl/strings is really great in the interim: https://abseil.io/docs/cpp/guides/strings https://abseil.io/docs/cpp/guides/strings