Thread overview | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
September 12, 2015 Difference between back (`) and double (") quoted strings | ||||
---|---|---|---|---|
| ||||
Attachments:
| Is there any or they are just simply syntactically equivalent? Are there any official docs on this?
--
Bahman Movaqar
http://BahmanM.com - https://twitter.com/bahman__m https://github.com/bahmanm - https://gist.github.com/bahmanm PGP Key ID: 0x6AB5BD68 (keyserver2.pgp.com)
|
September 12, 2015 Re: Difference between back (`) and double (") quoted strings | ||||
---|---|---|---|---|
| ||||
Posted in reply to Bahman Movaqar | On Saturday, 12 September 2015 at 08:13:33 UTC, Bahman Movaqar wrote: > Is there any or they are just simply syntactically equivalent? Are there any official docs on this? What if I told you, you should search the official reference before asking such things in the forum? http://dlang.org/lex.html#WysiwygString Wysiwyg: What you see is what you get <code> writeln(`\asd"fg"hj hmph'`); </code> <output> \asd"fg"hj haha' </output> |
September 12, 2015 Re: Difference between back (`) and double (") quoted strings | ||||
---|---|---|---|---|
| ||||
Posted in reply to NX | On 09/12/2015 12:52 PM, NX wrote: > What if I told you, you should search the official reference before asking such things in the forum? I did search the net for terms such as "d lang back quoted string" or "d lang multi line string" or "d lang string interpolation" before asking here. However the term "Wysiwyg string" didn't occur to my mind and from what I could gather from the net and the test programs I wrote, I couldn't determine the difference between `-string and "=string. Hence I decided to ask people here. > http://dlang.org/lex.html#WysiwygString Thanks for the help. -- Bahman Movaqar http://BahmanM.com - https://twitter.com/bahman__m https://github.com/bahmanm - https://gist.github.com/bahmanm PGP Key ID: 0x6AB5BD68 (keyserver2.pgp.com) |
September 12, 2015 Re: Difference between back (`) and double (") quoted strings | ||||
---|---|---|---|---|
| ||||
Posted in reply to NX | On Saturday, 12 September 2015 at 08:22:03 UTC, NX wrote:
> What if I told you, you should search the official reference before asking such things in the forum?
Searching is kinda hard, so I encourage people to ask if something doesn't come up quickly. And then we need to be sure to always answer because their question might be the thing that comes up on some future user's search, and if they see "google it", their reaction might be "what the &^&*%^ do you think brought me here?!?!?!"
(at least that's my reaction!)
|
September 18, 2015 Re: Difference between back (`) and double (") quoted strings | ||||
---|---|---|---|---|
| ||||
Posted in reply to Bahman Movaqar | On 09/12/2015 01:13 AM, Bahman Movaqar wrote: > Is there any or they are just simply syntactically equivalent? > Are there any official docs on this? > I realized that there was no index entry for back tick in my book. I've just added that and provided an Index section for the web version of the book. Click "Index (beta)" below to see a currently-ugly but hopefully useful Index section: http://ddili.org/ders/d.en/ Ali |
September 18, 2015 Re: Difference between back (`) and double (") quoted strings | ||||
---|---|---|---|---|
| ||||
Posted in reply to Bahman Movaqar | On Saturday, 12 September 2015 at 08:13:33 UTC, Bahman Movaqar wrote:
> Is there any or they are just simply syntactically equivalent? Are there any official docs on this?
it's like a raw string (prefixed with a r) so there is escaped char:
r"\": correct token for a string, terminal " is not escaped
`\`: correct token for a string, terminal ` is not escaped
"\": invalid token for a string, " is escaped
so it's usefull on Windows for example, if a litteral string contains a path, instead of
"C:\\folder\\file"
you can type
`C:\folder\file`
|
September 18, 2015 Re: Difference between back (`) and double (") quoted strings | ||||
---|---|---|---|---|
| ||||
Posted in reply to BBasile | On Friday, 18 September 2015 at 09:34:38 UTC, BBasile wrote:
> On Saturday, 12 September 2015 at 08:13:33 UTC, Bahman Movaqar wrote:
>> Is there any or they are just simply syntactically equivalent? Are there any official docs on this?
>
> it's like a raw string (prefixed with a r) so there is escaped char:
there **NO** escaped chars...godamnit typo.
|
September 18, 2015 Re: Difference between back (`) and double (") quoted strings | ||||
---|---|---|---|---|
| ||||
Posted in reply to BBasile | On Friday, 18 September 2015 at 09:35:53 UTC, BBasile wrote:
> On Friday, 18 September 2015 at 09:34:38 UTC, BBasile wrote:
>> On Saturday, 12 September 2015 at 08:13:33 UTC, Bahman Movaqar wrote:
>>> Is there any or they are just simply syntactically equivalent? Are there any official docs on this?
>>
>> it's like a raw string (prefixed with a r) so there is escaped char:
>
> there **NO** escaped chars...godamnit typo.
12 September 2015, '6 days ago',
mh haven't seen this initially. That's embarassing.
|
Copyright © 1999-2021 by the D Language Foundation