Method code for $string.find_escaped()

[Turn off line numbering]
  1: arg str, char;
  2: var good, start, pos, p;
  3: 
  4: good = 0;
  5: start = 0;
  6: while (!good && start < str.length()) {
  7:     pos = (char in str.subrange(start + 1)) + start;
  8:     good = 1;
  9:     if (pos > start) {
 10:         p = pos - 1;
 11:         while (p > 0 && str[p] == "\") {
 12:             good = good ? 0 : 1;
 13:             p = p - 1;
 14:         }
 15:     }
 16:     if (good)
 17:         return pos;
 18:     else
 19:         start = pos;
 20: }

// Created 27-Mar-1995 as a part of ColdCore, see: @help Credit

Tlon