Example:
Code: Select all
//§ Test GetTokenIndex()
"Test"
$lines = <<<#>>>
gd
eins1 <- line 2: OK
gfhjh
lines "with
continued" string
zwei2 <- line 6: NOK
jhgh
xfhg
drei3 <- line 9: NOK
#>>>;
$x1 = gettokenindex("eins*", $lines, <crlf>, 'iw');
$x2 = gettokenindex("zwei*", $lines, <crlf>, 'iw');
$x3 = gettokenindex("drei*", $lines, <crlf>, 'iw');
echo "x1 | 2 | 3 = $x1 | $x2 | $x3<crlf>Should be 2 | 6 | 9";And a related wish: gettokenindex() should have a starting-position, like e.g. strpos() has.
If I scan a (much larger!) file like above e.g. for section numbers, I should be able to start scan n+1 with the found position of scan n. But now all scans will/must restart at pos 1.
Very bad: if there's a table of contents - all section numbers will be found there - I can't scan for the real section.
(What I'm going to code won't work without that!)
XYplorer Beta Club