0
What is the difference between double quote string and single quote string?
6 Answers
+ 2
Asirap I'm referring to C++, also you used double quotes, and either way I'm wrong. You can't do this:
string str = 'Hello';
But you can do this:
string str = 'H';
So you can, but only a char. It'll store one character in the string. How about explaining it like this:
Single Quotes ('): Can only hold Char Characters (i.e. 'e', '#x27;, 'A', etc.).
Double Quotes ("): Can hold multiple characters (i.e. "Hello", "e", "amp;ÂŁ HiA", etc.).
+ 3
It depends on the language.
For example in Python there is no char, only Python's 'str'.
There you can use ' and " as you wish, and there's even the possibility to use three of one kind on each end of the string.
+ 2
the single quote one is called a character. It can only have one character like a digit or an alphabet or a special character like '1', 'a', '&' etc.
Strings are written with double quotes. It is an array of characters. It can be a single character or many like: "a" or "abc 123".
+ 2
Double quote is a string, single quote is a character.You can't use string to store a single quote string. It won't compile.
+ 2
It depends on programming language,
in some programming languages such as in Java and C++, double quote pairs represent a string and single quote pairs represent a char.
In some other programming languages, such as in Python, single quote pairs and double quote pairs are both used to represent a string. With no differences.