strSubstrCount method

int strSubstrCount(
  1. String search
)

Implementation

int strSubstrCount(String search) {
  return toLowerCase().split(search.toLowerCase()).length - 1;

  // example:
  // strSubstrCount('Hello World', 'o'); // returns 2
  // strSubstrCount('Hello World', 'l'); // returns 3
}