Function GetnstringPOS (N: Integer; Substring, Astring: String): Integer;
/ / Return the location of the nth subString appears in Astring
// If you didn't find it, return -1
VAR
FINDCOUNT: Integer;
POS: integer;
Begin
RESULT: = -1;
POS: = 0;
For FINDCOUNT: = 1 to n Do Begin
INC (POS);
While Midstr (Astring, Pos, Length (Substring) <> Substring Do Begin
If Length (Astring)
Exit; // Not found
INC (POS);
END;
END;
Result: = POS;
END;