On 10 January 2014 00:34, John Colvin <john.loughran.colvin@gmail.com> 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;

Ah yes. Well I really just want the offset anyway...


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.

Bugger that. This is not an example of "D is good at strings!".