string a = "12345"; string b = "123"; if (a.IndexOf(b) > -1) { MessageBox.Show("a中包含b"); } else { MessageBox.Show("a中不包含b"); }