Solved

Spreading string over multiple lines

Posted on 2004-10-13
2
1,082 Views
Last Modified: 2012-06-22
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
0
Comment
Question by:vo1d
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 14

Accepted Solution

by:
AvonWyss earned 125 total points
ID: 12298004
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
 
LVL 11

Author Comment

by:vo1d
ID: 12299206
thx very much. thats what i was looking for.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question