Spreading string over multiple lines

is there a possibility to spread a string over multiple lines like in c++ the \ does?
example:
i wanted to spread long command lines like in c++:
string test = "hi \
                    hi \
                    hi \
                    hi";
thats the same as if i would have
string test = "hi hi hi hi";
i dont want to use the + operator. thats a different thing.
thx
vo1d
LVL 11
vo1dAsked:
Who is Participating?
 
AvonWyssConnect With a Mentor Commented:
Use literal strings. Note that literal strings do not use escaped chars with \.

string test = @"hi
 hi
 hi
 hi";

This will do what you expect.
0
 
vo1dAuthor Commented:
thx very much. thats what i was looking for.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.