Count occurrences of a substring
![Task](http://static.miraheze.org/rosettacodewiki/thumb/b/ba/Rcode-button-task-crushed.png/64px-Rcode-button-task-crushed.png)
You are encouraged to solve this task according to the task description, using any language you may know.
The task is to either create a function, or show a built-in function, to count the number of non-overlapping occurrences of a substring inside a string. The function should take two arguments: the first argument being the string to search and the second a substring to be search for. It should return an integer count.
<lang pseudocode> print countSubstring("the three truths","th") 3
// do not count substrings that overlap with previously-counted substrings:
print countSubstring("ababababab","abab")
2 </lang>