Note: This website is archived. For up-to-date information about D projects and development, please visit

Escape Sequences

Part of TutorialIntermediate


Escape sequence are useful, but they can get tricky.

Demonstrates how to use escaping to put backslashes and apostrophes for a literal character.


import std.stdio;

const string backslashWYSIWYG = `\`;
const string quoteWYSIWYG = `'`;
const string doubleQuoteWYSIWYG = `"`;

const string doubleQuoteReg = "\"";
const string quoteReg = "\'";
const string backslashReg = "\\";

const char quoteChar = '\'';
const char backslashChar = '\\';

void main()
    writefln(doubleQuoteReg ~ "That's what I said!" ~ doubleQuoteReg);  


Author jcc7