// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.Text.RegularExpressions; namespace E { public class TestClass { public static bool Contains1(string s, string s2) { return s.IndexOf(s2) >= 0; } public static bool Contains2(string s, string s2) { return Regex.IsMatch(s, s2);; } public static void Test(string s, string s2) { Console.WriteLine(s + " " + s2 + " " + Contains1(s, s2) + " " + Contains2(s, s2)); } public static void Main(string[] args) { Test("bla bla", "la"); Test("bla bla", "xx"); Test("bla bla", "."); } } }