Only one of the two cases is considered. What am I doing wrong?

`
import std.array;
import std.conv;
import std.stdio;

void main()
{
  auto tokens = to!(dchar[][])(["D"d, "’"d, "Addario"d, "'"d]);
  // Or use this below:
  //~ dstring[] tokens = ["D"d, "’"d, "Addario"d, "'"d];
  while (!tokens.empty)
  {
    switch (tokens[0])
    {
      case "\u2019"d:
        writeln("Apostrophe smart " ~ tokens[0]);
        break;
      case "\u0027"d:
        writeln("Apostrophe straight " ~ tokens[0]);
        break;
      default:
        writeln("Other " ~ tokens[0]);
        break;
    }
    tokens = tokens[1..$];
  }
}
`
Prints:

Other D
Apostrophe smart ’
Other Addario
Other '

I would have expected:

Other D
Apostrophe smart ’
Other Addario
Apostrophe straight '  <== expected

Reply via email to