Questions related to the use of double-quotes in different programming languages.
Questions tagged [double-quotes]
1212 questions
873
votes
7 answers
Difference between single and double quotes in Bash
In Bash, what are the differences between single quotes ('') and double quotes ("")?

jrdioko
- 32,230
- 28
- 81
- 120
344
votes
18 answers
What is the difference between String.Empty and "" (empty string)?
In .NET, what is the difference between String.Empty and "", and are they interchangable, or is there some underlying reference or Localization issues around equality that String.Empty will ensure are not a problem?

johnc
- 39,385
- 37
- 101
- 139
291
votes
9 answers
Escape double quotes in a string
Double quotes can be escaped like this:
string test = @"He said to me, ""Hello World"". How are you?";
But this involves adding character " to the string. Is there a C# function or other method to escape double quotes so that no changing in string…

Mudassir Hasan
- 28,083
- 20
- 99
- 133
219
votes
7 answers
Double vs single quotes
Is there a specific time when I should use "" vs ''?
I've been using single quotes most of the time because it's easier to type but I'm not sure if I should.
e.g. get 'user/new' vs. get "user/new"

imjp
- 6,495
- 10
- 48
- 58
212
votes
20 answers
How can I add double quotes to a string that is inside a variable?
I have a string variable such as this:
string title = string.empty;
I have to display the content of whatever is passed to it inside a div within double quotes. I have written something like this:
...
...
"+ title +@"
...
...
How can I…
ANP
- 15,287
- 22
- 58
- 79
158
votes
5 answers
How do I put double quotes in a string in vba?
I want to insert an if statement in a cell through vba which includes double quotes.
Here is my code:
Worksheets("Sheet1").Range("A1").Value = "=IF(Sheet1!B1=0,"",Sheet1!B1)"
Due to double quotes I am having issues with inserting the string. How do…

user793468
- 4,898
- 23
- 81
- 126
122
votes
4 answers
bash alias command with both single and double quotes
I have the following command:
svn status | awk '$1 =="M"{print $2;}'
How do I make an alias out of it? I have tried:
alias xx="svn status | awk '$1 ==\"M\"{print $2;}'"

pragmatic_programmer
- 3,566
- 3
- 29
- 36
100
votes
8 answers
How to include quotes in a string
I have a string "I want to learn "c#"". How can I include the quotes before and after c#?

learning
- 11,415
- 35
- 87
- 154
97
votes
4 answers
Is there any practical reason to use quoted strings for JSON keys?
According to Crockford's json.org, a JSON object is made up of members, which is made up of pairs.
Every pair is made of a string and a value, with a string being defined as:
A string is a sequence of zero or more
Unicode characters, wrapped in…

Mark Rogers
- 96,497
- 18
- 85
- 138
95
votes
3 answers
How does the leading dollar sign affect single quotes in Bash?
I need to pass a string to a program as its argument from the Bash CLI, e.g
program "don't do this"
The string may include any character like '$', '\', etc. and I don't want Bash to do any modification. So I think about using single quotes.
However…

user1206899
- 1,564
- 1
- 11
- 15
92
votes
11 answers
How can I make Java print quotes, like "Hello"?
How can I make Java print "Hello"?
When I type System.out.print("Hello"); the output will be Hello. What I am looking for is "Hello" with the quotes("").

Roy
- 967
- 2
- 8
- 7
75
votes
5 answers
Omitting the double quote to do query on PostgreSQL
Simple question, is there any way to omit the double quote in PostgreSQL?
Here is an example, giving select * from A;, I will retrieve ERROR: relation "a" does not exist, and I would have to give select * from "A"; to get the real result.
Is there…

zfm
- 1,906
- 2
- 17
- 28
74
votes
9 answers
Is there any difference between "string" and 'string' in Python?
In PHP, a string enclosed in "double quotes" will be parsed for variables to replace whereas a string enclosed in 'single quotes' will not. In Python, does this also apply?

davidmytton
- 38,604
- 37
- 87
- 93
71
votes
4 answers
Calling one Bash script from another Script passing it arguments with quotes and spaces
I made two test bash scripts on Linux to make the problem clear.
TestScript1 looks like:
echo "TestScript1 Arguments:"
echo "$1"
echo "$2"
echo "$#"
./testscript2 $1 $2
TestScript2 looks like:
echo "TestScript2 Arguments…

nmadhok
- 1,704
- 3
- 16
- 20
57
votes
2 answers
What is the difference between ' and " in Prolog?
I am new to Prolog and noticed that ' and " give different behavior, but am curious as to why. Specifically, when loading a file, ?- ['test1.pl']. works, while ?- ["test1.pl"]. doesn't.

astay13
- 6,857
- 10
- 41
- 56