oh - and I forgot to mention stripping comments before splitting on lines, and truncating at maxsize bytes before doing *that*, except that maxsize is currently ignored completely - should I actually fix it to implement that, or is stuff likely to break if I do so ?  The related code taking input from a file, rather than a string, does honour its maxsize cut-off, which it applies before stripping comments.  It looks a lot like this cutoff merely exists to force folk to guess a value for it that's longer than the available data ...

Amending a local copy of the https://cfengine.com/docs/3.5/reference-functions-parsestringarrayidx.html example code (to something a tad more illuminating), I find my earlier conclusions about what the code does are indeed correct.