Small bug in doc (function return)

Ask questions about how to create a script or swap scripts with other users.
Post Reply
User avatar
pjj
Posts: 2109
Joined: 13 Oct 2009 13:48
Location: Kraków, Poland

Small bug in doc (function return)

Post by pjj »

For ScriptUtils.RegExPos (and for other similar functions) the doc states:
If nothing is found, the function returns 0 (zero).
In fact it is -1, not 0, as I just learnt:

Code: Select all

for (var i = 0; i < Document.LineCount; i++) {
    x = ScriptUtils.RegExPos("^\\s+", Document.Lines[i], exp);
    ShowMessage(x);
}
(I tested with ScriptUtils.RegExPos only, though.)
Alium tibi quaere fratrem; hic, quem tuum putas, meus est. Titus Flāvius Caesar Vespasiānus Augustus
Post Reply