Should this work?
John Colvin
john.loughran.colvin at gmail.com
Thu Jan 9 06:34:41 PST 2014
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.
More information about the Digitalmars-d
mailing list