c# - how to prevent two similar charactors occur together anywhere in a string -
i want prevent 2 similar characters example "@" occur anywhere in string. how can .this string:
static string email = " example@gmail.com";
in case of answer of moo-juice, can use linq in counof extension method:
public static class extensions { public static int countof(this string data, char c) { return string.isnullorempty(data) ? 0 : data.count(chk => chk == c); } }
Comments
Post a Comment