lookupParseRange

The lookupParseRange() function parses a single lookup()-style range into its constituent parts, returning them as strings in one strlst value. This can be used by Vortex scripts to edit a range. Syntax:

lookupParseRange(range, parts)

The parts argument is zero or more of the following part tokens as strings:

  • lowerInclusivity: Returns the inclusive/exclusive operator for the lower bound, e.g. "{" or "["

  • lowerBound: Returns the lower bound

  • rangeOperator: Returns the range operator, e.g. ".."

  • upperBound: Returns the upper bound

  • upperInclusivity: Returns the inclusive/exclusive operator for the upper bound, e.g. "}" or "]"

If a requested part is not present, an empty string is returned for that part. The concatenation of the above listed parts, in the above order, should equal the given range. Non-string range arguments are not supported.

The lookupParseRange() function was added in version 7.06.1528837000 20180612.


EXAMPLE

lookupParseRange('10..20', 'lowerInclusivity')

would return a single empty-string strlst, as there is no lower-bound inclusive/exclusive operator in the range "10..20".

lookupParseRange('10..20', 'lowerBound')

would return a strlst with the single value "10".


CAVEATS
For an implicit-upper-bound range, the upper bound is determined by the next range's lower bound. Since lookupParseRange() only takes one range, passing such a range to it may result in an incorrect (unlimited) upper bound. Thus the full list of ranges (if multiple) should always be given to lookupCanonicalizeRanges() first, and only then the desired canonicalized range passed to lookupParseRange().


SEE ALSO
lookup, lookupCanonicalizeRanges


Copyright © Thunderstone Software     Last updated: Apr 15 2024
Copyright © 2024 Thunderstone Software LLC. All rights reserved.