Working with Strings

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.


LVL 1
sdn421Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
AibrasConnect With a Mentor Commented:
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
 
sdn421Author Commented:
No wonder it did not work.  I was using / instead of \...DUH!  Thanks for your help.
0
 
sdn421Author Commented:
No wonder it did not work.  I was using / instead of \...DUH!  Thanks for your help.
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
sdn421Author Commented:
No wonder it did not work.  I was using / instead of \...DUH!  Thanks for your help.
0
 
sdn421Author Commented:
Aibras,

Let me know if your answer gets accepted.  I keep getting an error when I try to accept it.
0
 
sdn421Author Commented:
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
All Courses

From novice to tech pro — start learning today.