Solved

Replace Carriage return

Posted on 2004-08-06
8
16,443 Views
Last Modified: 2011-08-18
I would like to replace a Carriage Return with a space in C#
something like this:
myString.Replace(carriage return, " ")
Thanks
0
Comment
Question by:MichaelMullin
  • 4
  • 2
8 Comments
 
LVL 36

Assisted Solution

by:Zyloch
Zyloch earned 25 total points
ID: 11740872
Hi

You can use System.Text.RegularExpressions:

using System.Text.RegularExpressions;

string myString = "Hey\r\nWhat\r";
myString = r.Replace(myString, @"\r", " ");
Console.WriteLine(output);

Regards,
Zyloch
0
 
LVL 37

Expert Comment

by:gregoryyoung
ID: 11741058
you mean ...

string myString = "Hey\r\nWhat\r";
myString = myString.Replace(myString, @"\r", " ");
Console.WriteLine(myString);
0
 
LVL 36

Expert Comment

by:Zyloch
ID: 11741062
Ah, oops, that's my bad, sorry.
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 37

Expert Comment

by:gregoryyoung
ID: 11744576
actually ...

string myString = "Hey\r\nWhat\r";
myString = myString.Replace(@"\r", " ");
Console.WriteLine(myString);
0
 
LVL 37

Accepted Solution

by:
gregoryyoung earned 25 total points
ID: 11744587
Michael. Please you the feedback system for feedback and the question for questions on the original question. I say this because the feedback system does not alert me that you have placed a comment so it may be a long time before I see it :) In the question when you place a comment I will generally see it within a few hours.

Cheers,

Greg
0
 
LVL 37

Expert Comment

by:gregoryyoung
ID: 11758854
nah, you're rright it was absolutly collaborative.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

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