checkIndexes method

int checkIndexes(
  1. String searchedKey
)

Implementation

int checkIndexes(String searchedKey) {
  var i = -1;
  if (i == -1 || i < searchedKey.length) {
    while (this!.contains(searchedKey, i + 1)) {
      i = this!.indexOf(searchedKey, i + 1);

      if (i == 0 ||
          (i > 0 &&
              (RegExp("[^A-Za-z0-9 ]").hasMatch(this!.split("")[i]) ||
                  this!.split("")[i] == " "))) {
        return i;
      }
      i++;
    }
  }
  return -1;
}