I am trying to do a string out of this line:

Hello "Hello" Hello

However this does not work and I beleive it has to do with "Hello".

String^ str = "Hello "Hello" Hello";

Recommended Answers

All 6 Replies

The first double quote before the second Hello are causing the string to terminate. You can resolve this by putting single quotes instead of double quotes.

okay, I am trying this example where I want the String P to be in doublemarks in String Q but dont understand how to put it, so the actual string in the end look like this:

Test"Hello"

String^ P = "Hello";

String^ Q = "Test" + ' + P + ';
/// Are you looking for THIS?
 String^ str = "Hello \"Hello\" Hello";

Thank you, actually no. What I am trying is to put a declared string inside double quotes exactly like as in my previous post without writing the string out like that.

/// Are you looking for THIS?
 String^ str = "Hello \"Hello\" Hello";

following up on the post by thines01 :
This will print the string in double quotes

string str2 = "\"Hello\"";
cout<<str2;

The output of the above code is
"Hello"

Well, the closest I can see to get to that is this:

void main(void)
{
	String^ P = "Hello";
	String^ Q = "Test" + "\"" + P + "\"";

	Console::WriteLine(Q);
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.