Closed evantypanski closed 1 month ago
I went through everything, but I kept the default param stuff unresolved since I'm not completely convinced I took the right path there, let me know what you think. Enough should be in the commit message and initial comment, tl;dr is that I made the empty string default to the no-separator-provided behavior, I think that fixes the edge case of an empty string and simplifies
note: default param for split
was dropped in favor of the optional one for merge
This may or may not be enough for #1807 - but I'll let others decide that
This just adds a few easy methods for
string
that already had implementations forbytes
(or, even, within thestring
namespace). Those are:starts_with
split
split1
lower
upper
There are a couple of points worth noting:
1) The implementation for
split1
is a little inconsistent (andsplit
, but there are notes for that in code). I didn't want to change behavior for already defined functions here, so I just updated the docs to be more clear in my opinion. The main point is callingsplit1
with an empty string""
will immediately split, then put the whole string in the second value of the tuple. That may be entirely expected, but it's a little unintuitive at first 2) This doesn't implementfind
which was called out in the issue. That's just because it relies on theBytes
iterator and I wanted something in with the easy ones first. It may be just as easy, but this is enough for an initial bit :)So from here we could just go down the list of
bytes
operators and try to bring them all intostring
- but would that be worthwhile? Is this enough? I have no idea because I don't know the relative utility