splitter for strings

monarch_dodra via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jun 9 09:06:13 PDT 2014


On Monday, 9 June 2014 at 15:54:29 UTC, Steven Schveighoffer 
wrote:
> On Mon, 09 Jun 2014 11:49:29 -0400, monarch_dodra 
> <monarchdodra at gmail.com> wrote:
>
>> On Monday, 9 June 2014 at 14:21:21 UTC, Steven Schveighoffer 
>> wrote:
>>> Just looked at std.string for a strip function that allows 
>>> custom character strippage, but apparently not there. The 
>>> above is quite awkward.
>>>
>>> -Steve
>>
>> It's in algorithm, because it's more generic than just strings.
>
> Ugh.. This makes things difficult. If I want to work with 
> strings, I import std.string.
>
> I understand that the algorithm is applicable to all types, but 
> this makes for some awkward coding. What if you wanted to use 
> both? Surely we can come up with a better solution than this.
>
> -Steve

There's 2 different issues: The first, is that "split(string)" 
was pre-existing in std.string, and *then* split was introduced 
in algorithm. Where ideally (?) everything would have been placed 
in the same module, we true to avoid moving things around now.

The second thing is that "split" without any predicate/item can 
only make sense for strings, but not for generic ranges.

For what it's worth, I find it makes sense.


More information about the Digitalmars-d-learn mailing list