- List item
I have a string object such as the following.
string mycontent = "\"The time is Valid\"\n"
string tocompare = "The time is Valid"
The contents of mycontent are assigned by the following line of code.
string mycontent = await response.Content.ReadAsStringAsync();
I want to be able to remove all the \n
and the \
and to do that I do the following.
mycontent.Trim().Replace(@"\","")
I am trying to compare the mycontent
and tocompare
for equality. But this does not work.
if (string.Compare(tocompare, mycontent.Trim().Replace(@"\","")) == 0)
{
//TODO
}
For some reason which I do not know, I am not able to see equal to 0
.
Am I missing something here? Any help is appreciated.