char[] + utf-8 + canFind == bug?

Andrea Fontana advmail at katamail.com
Tue Nov 22 09:02:53 PST 2011


dchar works but simple solution doesn't.

code:

char[] chars = "òà";
chars.canFind('à');

It says:

Error: cannot implicitly convert expression ("\xc3\xb2\xc3\xa0") of type
string to char[]
Error: template std.algorithm.canFind(alias pred = "a == b",Range,V) if
(is(typeof(find!(pred)(range,value)))) does not match any function
template declaration
Error: template std.algorithm.canFind(alias pred = "a == b",Range,V) if
(is(typeof(find!(pred)(range,value)))) cannot deduce template function
from argument types !()(char[],wchar)

Il giorno mar, 22/11/2011 alle 08.49 -0800, Jonathan M Davis ha scritto:

> On Tuesday, November 22, 2011 17:38:36 Andrea Fontana wrote:
> > I guess I should use wchar instead of char. :)
> 
> Individual characters really should be processed as dchars in the general 
> case. There's a simple solution here though:
> 
> char[] chars = "àèì";
> 
> - Jonathan M Davis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20111122/f97a18f3/attachment.html>


More information about the Digitalmars-d mailing list