code: private int indexOf( String content, String needle, int offset ) {
          int index;
          while( (index = content.indexOf(needle, offset)) != -1 ) {
              String text = getLine(content, index).trim();
              if (text.startsWith(needle) || text.endsWith(needle))
                  break;
              else
                  offset = index + 1;
          }
          return index;
      }
docs: /*
  Assume the needle will the found at the start/end of the line