Noobie question regarding new line string concatenation
Sep 3, 2009 at 12:49pm UTC
Hi all,
I have one very simple querstion here.
How can I do something like this in C++ :
1 2 3
string myString = "blablablabla"
+"blablablabla"
+ "blablablabla" ;
Like in Java for example.
I need this for longer strings...
Regards
Sep 3, 2009 at 1:02pm UTC
"blablablabla"
in C++ isn't a string but a pointer to a character sequence. You need to convert the first one to a string before calling the + operator:
1 2 3
string myString = string("blablablabla" )
+"blablablabla"
+ "blablablabla" ;
Sep 3, 2009 at 1:26pm UTC
Hmm... I think I accidentally have found the answer.
string myString = "blablablabla"
"blablablabla"
"blablablabla";
I think this one will do the job.
Topic archived. No new replies allowed.