Should this work?
John Colvin
john.loughran.colvin at gmail.com
Thu Jan 9 07:20:13 PST 2014
On Thursday, 9 January 2014 at 14:34:43 UTC, John Colvin wrote:
> On Thursday, 9 January 2014 at 14:08:02 UTC, Manu wrote:
>> This works fine:
>> string x = find("Hello", 'H');
>>
>> This doesn't:
>> string y = find(retro("Hello"), 'H');
>> > Error: cannot implicitly convert expression
>> (find(retro("Hello"), 'H'))
>> of type Result!() to string
>
> In order to return the result as a string it would require an
> allocation. You have to request that allocation (and associated
> eager evaluation) explicitly
>
> string y = "Hello".retro.find('H').to!string;
>
>
> However, I think to get the expected result from unicode you
> need
>
> string y = "Hello".byGrapheme.retro.find('H').to!string;
>
> but I might be wrong.
Oh. I see you actually wanted strrchr behaviour. That's different.
More information about the Digitalmars-d
mailing list