parse string as char

Timothee Cour via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Feb 8 18:40:26 PST 2015


Is there a simple way to parse a string as a char?
eg:
unittest{
  assert(parseChar(`a`)=='a');
  assert(parseChar(`\n`)=='\n'); //NOTE: I'm looking at `\n` not "\n"
  // should also work with other forms of characters, see
http://dlang.org/lex.html
}
Note, std.conv.to doesn't work (`\n`.to!char does not work)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20150208/bf1f5663/attachment.html>


More information about the Digitalmars-d-learn mailing list