>  Docs Center  >  Libraries  >  Buie  >  RANGEPAR
Libraries

RANGEPAR

RANGEPAR

Name


    rangepar

Purpose (one Line)


    Parse a string with numbers and ranges to get an expanded list of numbers.

Description


  You can provide single numbers or a range of numbers. Ranges are
    delineated by a hyphen (for example 120-125). Ranges or single numbers
    are separated by either a comma or space. Spaces (even multiples) are
    tolerated anywhere. But, only one comma is allowed between numbers or
    ranges. The string can have an optional exclusion descriptor. Anything
    after the first 'x' is used as an exclusion set (ranges or numbers,
    same syntax).
  For example, the string '100-105x103' would return [100,101,102,104,105]
      as an array of integers.
  If the input is [100,101,102,104,105] the result would be '100-102,105-105'

Category


  Utility

Calling Sequence


    rangepar,input,output

Inputs


    input - if input is a string, it is parsed to generate a list of numbers
                (see description)
              if input is an array of numbers it is converted to a string.

Optional Input Parameters


Keyword Parameters


Outputs


    output - string or integer array depending on the input.

Common Blocks


Side Effects


Restrictions


  In the reverse conversion (from numbers to a string), the routine
    will handle negative numbers but will produce output like -5--3
    which rangepar can't parse in the other direction. Also, the
    'x' construct is not used in this direction. Thus there is no
    promise that applying rangepar twice will return you to an
    identical starting point (though the implied list is the same).

Procedure


Modification History


    2001/07/25 - Written by Marc W. Buie, Lowell Observatory.
    2008/12/05 - Peter L. Collins, Lowell Observatory, added /REVERSE.
    2009/11/19, MWB, removed REVERSE and made operation context dependent.



© 2024 NV5 Geospatial Solutions, Inc. |  Legal
   Contact Us