Question: I store 2 serialized object in 2 text file and then i read both and store it in 2 different string, and try to compare this 2 strings, the comparison failed more then one time because of the carriage return and new line difference in the end of one of the string, 
how i could compare both with ignoring spaces or carriage returns, I know I can compress the 2 strings and compare them, but is there anything like done by .net library, Like Icomparer, I'm not sure if this will work for me too.

thank you in advance 
Jp

Answer: 
If both values are stored as strings, the `String.Trim()` function will take care of your troublesome whitespace characters, or just compare whilst replacing the whitespace characters.

```
        string a = "string comparison\r\n";
        string b = "string comparison";

        string c = a.Trim();
        string d = b.Trim();

        if (c == d)
            Console.WriteLine("strings are equal");
        else
            Console.WriteLine("strings are not equal");

        string e = a.Replace("\r\n", "");
        string f = b.Replace("\r\n", "");

        if (e == f)
            Console.WriteLine("strings are equal");
        else
            Console.WriteLine("strings are not equal");

```
If you're reading line by line, just ignore any characters that represent line breaks between them.
If you expect line breaks, simply convert to identical characters using a find and replace.