Should this work?

Jacob Carlborg doob at me.com
Fri Jan 10 00:46:59 PST 2014


On 2014-01-10 07:18, Manu wrote:

> Surely it can't be *ptr and ++ptr as you say, otherwise none of it would
> be unicode safe...?

For UTF-8 strings it's an extra if-statement:

immutable c = str[0];
if(c < 0x80)
{
     //ptr is used to avoid unnnecessary bounds checking.
     str = str.ptr[1 .. str.length];
}

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list