findAll method

List<int> findAll(
  1. String aStr,
  2. String sub
)

Implementation

List<int> findAll(String aStr, String sub) {
  int start = 0;
  List<int> output = [];
  while (true) {
    start = aStr.indexOf(sub, start);
    if (start == -1) {
      break;
    }
    output.add(start + sub.length);
    start += sub.length;
  }
  return output;
}