String Prefix Predicate
monarch_dodra via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Aug 19 01:23:51 PDT 2014
On Monday, 18 August 2014 at 20:50:55 UTC, Nordlöw wrote:
> On Monday, 18 August 2014 at 12:42:25 UTC, monarch_dodra wrote:
>> If you are using a string, the only thing helpful in there is
>> `byCodeunit`. The rest is only useful if you have actual
>> ranges.
>
> Actual ranges of...characters and strings? Could you gives some
> examples? I'm curious.
You could define your own range of chars, for example, a "rope".
Or, you want to store your string in a deterministic container
("Array!char"). These would produce individual code units, but
you'd still need them to be interpreted your range as a sequence
of code points. This is where `byDchar` would come in handy.
There is a fair bit of discrepancy between a "char[]", and a
range where `ElementType!R` is `char`, which is quite
unfortunate. There have been talks of killing auto-decode, in
which case, a range of chars would have the same behavior as a
char[].
More information about the Digitalmars-d-learn
mailing list