?
Solved

Spreading string over multiple lines

Posted on 2004-10-13
2
Medium Priority
?
1,091 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 500 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month12 days, 23 hours left to enroll

777 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