Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Best method to strip the CRLF in C#
Message
De
30/04/2007 11:23:15
 
 
À
30/04/2007 11:17:24
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 2.0
OS:
Windows XP SP2
Divers
Thread ID:
01221137
Message ID:
01221141
Vues:
17
>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);


Alex Feldstein, MCP, Microsoft MVP
VFP Tips: English - Spanish
Website - Blog - Photo Gallery


"Once again, we come to the Holiday Season, a deeply religious time that each of us observes, in his own way, by going to the mall of his choice." -- Dave Barry
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform