Wednesday, July 9, 2008

Remove Whitespace

I added this method to the StringManip class in DCToolbox:


protected string RemoveWhiteSpace(string str)
{
if (str.Length > 0)
{
while (str.IndexOf(" ") > 0)
{
str = Regex.Replace(str, " ", "");
}
}
str = str.Trim();
return str;
}

No comments: