public static string RemoveIllegalCharacters(string stringValue)
{
string pattern = @"[^\w\s\-\+]";
string replacement = " ";
string noResultText = "noresult";
Regex regEx = new Regex(pattern);
string sanitized = regEx.Replace(stringValue, replacement);
if (!string.IsNullOrEmpty(sanitized.Trim()))
return sanitized;
else
return noResultText;
}
No comments:
Post a Comment