private bool isvalidString(string str) { int i = 0; int lastIndex = -2; bool retvalue = true; do { i = str.IndexOf("/", i + 1); if (lastIndex + 1 == i) { retvalue = false; break; } lastIndex = i; if (i==-1) { break; } } while (true); return retvalue; }
string SomeString = "hello//abc"; Regex r = new Regex("^[a-zA-Z0-9]*$"); if (r.IsMatch(SomeString)) { lbl_valid.Text = "Valid"; } else { lbl_valid.Text = "In-Valid"; }
private bool isvalidString(string str) { return !str.Contains(@"//"); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)