Click here to Skip to main content
15,890,123 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How do I remove the "\r" and "\n" also the "@media only screen and (min-width: 632px) { .containerClass { width : 600px !important; } .hidden { display: inline-block !important; } .photo_display { float: left !important; } .centerContainer { width: 490px !important; } .halfWidth { width: 50% !important; } }"

"\r\n\r\n    New message for 5522 Marbut Forest Way, Lithonia\r\n    \r\n        @media only screen and (min-width: 632px)\r\n        {\r\n            .containerClass\r\n            {\r\n              width : 600px !important;\r\n            }\r\n            .hidden\r\n            {\r\n              display: inline-block !important;\r\n            }\r\n            .photo_display\r\n            {\r\n              float: left !important;\r\n            }\r\n            .centerContainer\r\n            {\r\n              width: 490px !important;\r\n            }\r\n            .halfWidth {\r\n              width: 50% !important;\r\n            }\r\n        }\r\n    \r\n  \r\n  \r\n    \r\n\r\n  \r\n  \r\n    \r\n      \r\n  \r\n  \r\n    \r\n      \r\n          \r\n            \r\n            \r\n              \r\n              Submit Listings |\r\n              View Leads |\r\n              Answer Questions\r\n              \r\n            \r\n          \r\n      \r\n    \r\n  \r\n  \r\n  \r\n  \r\n  \r\n  \r\n\r\n    \r\n\r\n  \r\n  \r\n    \r\n      \r\n        \r\n          \r\n            \r\n              \r\n                \r\n                  \r\n                    Hi Leasing,\r\n                  \r\n                  \r\n                    A new renter is interested in your listing at 5522 Marbut Forest Way.\r\n                    Check out the details below.\r\n                  \r\n                \r\n              \r\n              \r\n                \r\n                \r\n                  \r\n                    \r\n                      From: Mario \r\n                    \r\n                  \r\n                  \r\n                    \r\n                      Email: jermariodorsey45@gmail.com*\r\n                    \r\n                  \r\n                                      \r\n                      \r\n                        Phone: (901) 618-3090\r\n                      \r\n                    \r\n                                    \r\n                    \r\n                      Message: I am interested in this rental and would like to schedule a viewing. Please let me know when this would be possible.\r\n                    \r\n                  \r\n                  \r\n  \r\n    \r\n  \r\n\r\n                  \r\n                                    \r\n  \r\n    \r\n  \r\n\r\n                  \r\n                    Please click Reply in your e-mail client to reply to the new renter.\r\n                  \r\n                  \r\n                    \r\n                      \r\n                        * This email address may be anonymized to protect the privacy of our users.\r\n                      \r\n                    \r\n                  \r\n                \r\n                \r\n              \r\n              \r\n                \r\n                  \r\n                    \r\n                      \r\n                        \r\n                          Your listing details:\r\n                        \r\n                      \r\n                    \r\n                  \r\n                  \r\n                    \r\n                      \r\n                        \r\n                                                      \r\n                                                  \r\n                      \r\n                      \r\n                        \r\n                          \r\n                            5522 Marbut Forest Way,\r\n                            Lithonia, GA\r\n                          \r\n                          $870/mo.\r\n                          3 br, 2 ba\r\n                          Single-Family Home\r\n                                                  \r\n                      \r\n                    \r\n                  \r\n                \r\n              \r\n            \r\n          \r\n        \r\n      \r\n    \r\n  \r\n  \r\n\r\n    \r\n        \r\n\r\n  \r\n    \r\n      \r\n        \r\n                \r\n          \r\n            This email was sent to leasing@altisourcerentals.com.\r\n          \r\n        \r\n                        \r\n          \r\n            Trulia, Inc. | 535 Mission Street, Suite 700, San Francisco, CA 94105\r\n          \r\n        \r\n      \r\n    \r\n  \r\n\r\n    \r\n  \r\n\r\n\r\n"


What I have tried:

C#
string body = item2.HTMLBody;

body = regex.Replace(body, String.Empty);
string body2 = "<html><body>" + body + "</body></html>";

Panel1.Controls.Add(new LiteralControl(body2));
Posted
Updated 15-Feb-16 10:49am
v2
Comments
Sergey Alexandrovich Kryukov 15-Feb-16 17:44pm    
HTML strings have nothing to do with \r\n and other character delimiters. Each of them is equivalent to a single space.
What exactly do you want to remove, when, why?
—SA
[no name] 16-Feb-16 0:02am    
Try like that:

string text = ""\r\n\r\n New message for 5522 Marbut Forest Way, Lithonia\r\n";
text = text.Replace("\r\n", "").Replace("\r", "").Replace("\n", "");

1 solution

C#
string body = item2.HTMLBody;
body.Replace("","\r\n");</pre>
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900