Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Remove newline charcters froma string

Reply
Thread Tools

Remove newline charcters froma string

 
 
peelman
Guest
Posts: n/a
 
      10-18-2005
For some reason this is not working for me. How to remove all newline
characters from a string? I have tried:

myString.Replace ("\n", "");

I have also tried using TrimStart and TrimEnd methods from String
(using a char array with a '\n' in it), but to no avail.

Has it to do with the '\r' somewhere in there, or is there just an
easier way to this? I know this should not be hard.

Thanks in advance,

NC

 
Reply With Quote
 
 
 
 
Karl Seguin
Guest
Posts: n/a
 
      10-18-2005
myString = myString.Replace(System.Environment.NewLine, "");

Karl

P.S. - yes, it probably have something to do with \r

--
MY ASP.Net tutorials
http://www.openmymind.net/
"peelman" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> For some reason this is not working for me. How to remove all newline
> characters from a string? I have tried:
>
> myString.Replace ("\n", "");
>
> I have also tried using TrimStart and TrimEnd methods from String
> (using a char array with a '\n' in it), but to no avail.
>
> Has it to do with the '\r' somewhere in there, or is there just an
> easier way to this? I know this should not be hard.
>
> Thanks in advance,
>
> NC
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Accented charcters in Asp.net charvind ASP .Net 0 08-13-2008 04:51 PM
ASP.NET 2.0 TextBOx WildCard charcters ABHIJIT B ASP .Net 0 02-20-2008 04:54 PM
Remove unwanted charcters from a string Chris Kettenbach ASP .Net 1 07-20-2005 06:24 PM
Control charcters in form input field Paul Jørstad Javascript 4 09-19-2003 08:01 PM
charcters styles via html brandons of mass destruction XML 1 07-30-2003 07:34 PM



Advertisments