string strData1 = "'INSERT BLASÉ KSEM2200HPM"; string strData = string.Empty; for (int i = 0; i < 256; i++) { if(!(i>=32 && i<= 126)) strData += ((char)i).ToString(); } int indexOf = strData1.IndexOfAny(strData.ToCharArray()); if (indexOf == -1) { MessageBox.Show("Valid chars"); } else { MessageBox.Show(" contain invalid chars"); }
bool m = Regex.IsMatch("INSERT BLASE", "^[\x20-\x7E]*$");
string input = "INSERT BLASÉ KSEM2200HPM"; Match match = Regex.Match(input, "[^ -~]"); if (match.Success) Console.WriteLine("not ok."); else Console.WriteLine("ok.");
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)