Any ideas?
My program is a file validation utility and I have to read in a format file then parse out each line by a single space. But obviously, the person who wrote the format file may use tabs, or 2 spaces, or any form of whitespace, and I'm looking for some code to do that. I've tried this:
public static string RemoveWhitespace(this string line)
{
try
{
return new Regex(@"\s*").Replace(line, " ");
}
catch (Exception)
{
return line;
}
}
I'm assuming this is wrong.
Help!