Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Best method to strip the CRLF in C#
Message
From
30/04/2007 11:29:03
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
 
 
To
30/04/2007 11:23:15
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
C# 2.0
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01221137
Message ID:
01221143
Views:
23
>>I am working with a serial port object and receive a line feed and carriage return as the ending on each incoming data stream. I would like to strip these off each time before passing the string on. What is the most appropriate method to do this? string.substring(), string.trim(), or something else?
>
>There are many ways to skin a cat.
>Here's one:
>
>string txt;
>txt = txt.Replace("\r\n", string.Empty);
>
Ok so if might look like this:
string read = "EVT:TRIGGER Read GPIO 0" + "\r\n"

I want to then strip the line feed and return back off and leave the rest. You are saying this will replace with an empty string on the end of it? That works for me. Thanks, that is pretty clean method to use.
Tim
Timothy Bryan
Previous
Reply
Map
View

Click here to load this message in the networking platform