I'm trying to develop a script which compares a runtime generated string against one which is input by the user. Unfortunately, since user inputs his code using a textbox, I get ^M in the string input by user.
Example, If I print these strings to file I get this:

User Input:
1^M
2^M
3
Output of script:
1
2
3

Obviously, when I try to compare these two strings, I get a false. What would be the most efficient way to sort this problem? Just in case you haven't noticed, all lines entered by user "donot" end with "^M". The last line in this user string has no ^M, while output of code has a "\n" at the end. Thanks in advance.