I'm trying to get messages from Gmail in C#
but the message body comes like this "\r\n\r\nBODY\r\n\r\n"
How can I get the "BODY" out of the string ?
I tried to loop through it but I found out that when looping the "\r" becomes a " "
You can use String.Trim() to remove all leading and trailing whitespace form a given string. Something like this:
var body = inputString.Trim();
This would cover /r/n characters, as well as any other whitespace.
try this:
string after = text.Replace(Environment.NewLine, "");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With