www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Does D have a Verbatim String Literal?

reply "Bennie Copeland" <mugen.kanosei gmail.com> writes:
For example in C# I can write  "Hello \t World"; and it will 
print "Hello \t World" exactly without requiring me to escape the 
\t. Does D have a similar feature?
Mar 29 2012
next sibling parent simendsjo <simendsjo gmail.com> writes:
On Thu, 29 Mar 2012 11:15:21 +0200, Bennie Copeland  
<mugen.kanosei gmail.com> wrote:

 For example in C# I can write  "Hello \t World"; and it will print  
 "Hello \t World" exactly without requiring me to escape the \t. Does D  
 have a similar feature?

There are two ways: import std.stdio; void main() { writeln(r"Hello \t World"); writeln(`Hello \t World`); }
Mar 29 2012
prev sibling parent "Bennie Copeland" <mugen.kanosei gmail.com> writes:
On Thursday, 29 March 2012 at 09:18:38 UTC, simendsjo wrote:
 On Thu, 29 Mar 2012 11:15:21 +0200, Bennie Copeland 
 <mugen.kanosei gmail.com> wrote:

 For example in C# I can write  "Hello \t World"; and it will 
 print "Hello \t World" exactly without requiring me to escape 
 the \t. Does D have a similar feature?

There are two ways: import std.stdio; void main() { writeln(r"Hello \t World"); writeln(`Hello \t World`); }

Awesome. Thank you.
Mar 29 2012