Solved

Working with Strings

Posted on 2002-07-25
6
228 Views
Last Modified: 2010-04-15
This should be an easy question.

I am trying to append a carriage return and line feed between two strings.  

string s1 = "line 1 of text";
string s2 = "line 2 of text";
string s3 = s1 + "(line feed carrige return)" + s2;

I want there to be a carriage return and line feed between s1 and s2 so I can then use ReadLine() to read each line of the string.  I tried using /r and /n between the strings, but then ReadLine() does not work.  It reads the entire string as one line.  This should be an easy question to answer.  I looked around, but I could not find any examples.

Thanks in advance.


0
Comment
Question by:sdn421
[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
  • 5
6 Comments
 

Accepted Solution

by:
Aibras earned 100 total points
ID: 7177891
you can use "\n" new line not /n :)

try this code

-------------

          static void Main()
          {
               string s1 = "experts";
               string s2 = "exchange";
               string s3 = s1 + "\n" + s2;
                        // "\n" New line
               Console.Write(s3);

          }

-----------------------------
0
 
LVL 1

Author Comment

by:sdn421
ID: 7177957
No wonder it did not work.  I was using / instead of \...DUH!  Thanks for your help.
0
 
LVL 1

Author Comment

by:sdn421
ID: 7177958
No wonder it did not work.  I was using / instead of \...DUH!  Thanks for your help.
0
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
LVL 1

Author Comment

by:sdn421
ID: 7177970
No wonder it did not work.  I was using / instead of \...DUH!  Thanks for your help.
0
 
LVL 1

Author Comment

by:sdn421
ID: 7177974
Aibras,

Let me know if your answer gets accepted.  I keep getting an error when I try to accept it.
0
 
LVL 1

Author Comment

by:sdn421
ID: 7178359
Aibras,

It still will not let me accept your answer so I posted the problem in the support forum.  Thanks for you help again.

http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=commspt&qid=20328025
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

695 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