private static string Cleanse(string InputString)
{
//过滤掉 And AND aNd 等包含And的字符
MatchCollection ms = Regex.Matches(InputString, " (a|A)+(n|N)+(d|D)+ ");
foreach(Match m in ms)
{
InputString = InputString.Replace(m.Value, "");
}
return InputString;
}
private static bool IsLegalCharacter(char c)
{
//去除不是A-Z的字符以及去除元音 aeoiuy
if (Regex.IsMatch(c.ToString().ToLower()
, "[b-d]|[f-h]|[j-n]|[p-t]|[v-x]|[z]"))
{
return true;
}
return false;
}
{
//过滤掉 And AND aNd 等包含And的字符
MatchCollection ms = Regex.Matches(InputString, " (a|A)+(n|N)+(d|D)+ ");
foreach(Match m in ms)
{
InputString = InputString.Replace(m.Value, "");
}
return InputString;
}
private static bool IsLegalCharacter(char c)
{
//去除不是A-Z的字符以及去除元音 aeoiuy
if (Regex.IsMatch(c.ToString().ToLower()
, "[b-d]|[f-h]|[j-n]|[p-t]|[v-x]|[z]"))
{
return true;
}
return false;
}