In Perl, how to remove ^M from a file?
^M is carriage return. You can do this: $str =~ s/\r//g
^M is carriage return. You can do this: $str =~ s/\r//g
You can remove all control characters from your input string with something like this: string input; // this is your input string string output = new string(input.Where(c => !char.IsControl(c)).ToArray()); Here is the documentation for the IsControl() method. Or if you want to keep letters and digits only, you can also use the IsLetter and IsDigit … Read more
As others have said, you could use :set list which will, in combination with :set listchars=… display invisible characters. Now, there isn’t an explicit option which you can use to show whitespace, but in listchars, you could set a character to show for everything BUT whitespace. For example, mine looks like this :set listchars=eol:$,tab:>-,trail:~,extends:>,precedes:< so, … Read more