Advertisement
Guest User

Untitled

a guest
Aug 4th, 2015
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. public static int P(this string baseStr, string inputStr)
  2. {
  3. return new Regex(inputStr).Matches(baseStr).Count;
  4. }
  5.  
  6. string data = "1111";
  7. Console.WriteLine(data.P("11")); //2
  8.  
  9. string data = "1111";
  10. string sub = "11";
  11. Console.WriteLine(data.P(string.Format("(?=({0}))", sub));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement