Error using `equal` with various string types
Andrej Mitrovic
andrej.mitrovich at gmail.com
Sat Feb 23 21:21:05 PST 2013
On 2/24/13, Jonathan M Davis <jmdavisProg at gmx.com> wrote:
> Because the compiler doesn't general deal on the level of code points. It
> deals with code units, and it doesn't generally treat strings as being
> special
> at all. So, you can't compare string and dstring any more than you can
> compare
> ubye[] and uint[]. Pretty much the only place in the language where you get
>
> automatic decoding is when you ask for it with a foreach loop by making the
>
> iteration type dchar.
I'm specifically talking about Phobos, that's why I tried to use
equals rather than == which doesn't work of course.
> It just isn't recursive, which is why you're having trouble.
I don't understand, what does recursion have to do with anything?
I want these to work:
"foo".equal("foo".dup);
"foo".equal("foo"w);
"foo".equal("foo"w.dup);
"foo".equal("foo"d);
"foo".equal("foo"d.dup);
Or is there some other function that can be used to compare two
strings whatever their encoding may be?
More information about the Digitalmars-d-learn
mailing list