ImapParseSet
function ImapParseSet(const aSpec: string; aCount: Integer; out aValues: TArray<Integer>): Boolean;
'1,3:5,7:*' over aCount messages -> ascending, de-duplicated 1-based numbers. '*' is aCount (RFC 3501 sec.9), and a range is valid in either order.