Iterate over each (optionally padded) string element in RangeSet.
500838
def striter(self):
        """"""
        pad = self.padding or 0
        for i in self._sorted():
            yield "%0*d" % (pad, i)
1063213
private int processSet(String regex, int i, StringBuilder result, UnicodeSet temp, ParsePosition pos) {
        try {
            pos.setIndex(i);
            UnicodeSet x = temp.clear().applyPattern(regex, pos, symbolTable, 0);
            x.complement().complement(); // hack to fix toPattern
            result.append(x.toPattern(false));
            i = pos.getIndex() - 1; // allow for the loop increment
            return i;
        } catch (Exception e) {
            throw (IllegalArgumentException) new IllegalArgumentException("Error in " + regex).initCause(e);
        }
    }
1293835
private static Set<String> setFor( String... elements ) {
        Set<String> set = new HashSet<String>(elements.length);
        set.addAll(Arrays.asList(elements));

        return set;
    }
1197436
private static String[] splitRangeUnit(final String str) {
    if(StringUtils.isBlank(str)) {
      return new String[]{""};
    }
    return str.split(RANGE_UNIT_PATTERN);
  }
1372985
function padding (string, span = 2) {
  const spaces = ' '.repeat(span)
  return spaces + string.replace(/\n/g, `\n${spaces}`)
}
310018
function toRanges(str) {
  var ranges = [], i;

  str = str.slice(1, -1);

  while (str.length) {
    for (i = 1; ; i++) {
      if (str[i] !== String.fromCharCode(str[i - 1].charCodeAt(0) + 1)) {
        if (i < 3) {
          ranges.push(str.slice(0, i));
        } else {
          ranges.push(str[0] + '-' + str[i - 1]);
        }
        str = str.slice(i);
        break;
      }
    }
  }
  return '[' + ranges.join('') + ']';
}
327490
def hyphen_range(string):
    '''
    
    '''
    list_numbers = list()
    temporary_list = string.split(',')

    for element in temporary_list:
        sub_element = element.split('-')

        if len(sub_element) == 1:
            list_numbers.append(int(sub_element[0]))
        elif len(sub_element) == 2:
            for x in range(int(sub_element[0]), int(sub_element[1])+1):
                list_numbers.append(x)
        else:
            raise Exception('Something went wrong expanding the range'.format(string))

    return list_numbers
764657
public static Set<String> commaDelimitedListToSet(String str) {
        Set<String> set = new TreeSet<String>();
        String[] tokens = commaDelimitedListToStringArray(str);
        Collections.addAll(set, tokens);
        return set;
    }
819692
def parse_set(self):
        """"""
        lineno = next(self.stream).lineno
        target = self.parse_assign_target(with_namespace=True)
        if self.stream.skip_if('assign'):
            expr = self.parse_tuple()
            return nodes.Assign(target, expr, lineno=lineno)
        filter_node = self.parse_filter(None)
        body = self.parse_statements(('name:endset',),
                                     drop_needle=True)
        return nodes.AssignBlock(target, filter_node, body, lineno=lineno)
708518
function sliceSet(set, skip = 0, count = set.size - skip) {
  const iterator = set.values()
  const output = new Set()
  while (count >= 0 && count--) {
    while (skip >= 0 && skip--) {
      iterator.next()
    }
    const {done, value} = iterator.next()
    if (done) {
      return output
    }
    output.add(value)
  }
  return output
}
190693
private static <L extends List<String>> L trimStringList(L strings)
    {
        for (ListIterator<String> listIt = strings.listIterator(); listIt.hasNext(); )
        {
            String string = listIt.next().trim();
            listIt.set(string);
        }
        return strings;
    }
394236
public static Set<Integer> parseRange(String range) {
        if (range == null) {
            return Collections.emptySet();
        }
        Set<Integer> ret = new LinkedHashSet<>();
        StringTokenizer stringTokenizer = new StringTokenizer(range, String.format("%s%s", COMMA, DASH), true);
        Integer from = null;
        Integer to = null;
        boolean rangeStarted = false;
        while (stringTokenizer.hasMoreTokens()) {
            String token = stringTokenizer.nextToken();
            if (isValueDelimiter(token)) {
                ret.addAll(fromToAsSet(from, to));
                from = null;
                to = null;
                rangeStarted = false;
            } else if (isRangeDelimiter(token)) {
                rangeStarted = true;
            } else {
                String trimmedValue = token.trim();
                if (!isPositiveInt(trimmedValue)) {
                    throw new IllegalArgumentException("Range values should be positive numbers.");
                }
                Integer parsedInteger = Integer.parseUnsignedInt(trimmedValue);
                if (rangeStarted) {
                    to = parsedInteger;
                } else {
                    from = parsedInteger;
                }
            }
            if (from != null) {
                ret.addAll(fromToAsSet(from, to));
            }
        }

        return ret;
    }
356899
def _get_casing_permutations(cls, input_string):
        
        if not input_string:
            yield ""
        else:
            first = input_string[:1]
            for sub_casing in cls._get_casing_permutations(input_string[1:]):
                yield first.lower() + sub_casing
                yield first.upper() + sub_casing
685091
def update(self, iterable):
        """"""
        if isinstance(iterable, RangeSet):
            # keep padding unless is has not been defined yet
            if self.padding is None and iterable.padding is not None:
                self.padding = iterable.padding
        assert type(iterable) is not str
        set.update(self, iterable)
1268416
def _string_parser(strip_whitespace):
    """"""
    def _parse_string_value(element_text, _state):
        if element_text is None:
            value = ''
        elif strip_whitespace:
            value = element_text.strip()
        else:
            value = element_text

        return value

    return _parse_string_value
372960
def itertypes(iterable):
    """"""
    seen = set()
    for entry in iterable:
        if isinstance(entry, tuple):
            for type_ in entry:
                if type_ not in seen:
                    seen.add(type_)
                    yield type_
        else:
            if entry not in seen:
                seen.add(entry)
                yield entry
62948
def parse_range_pairs(s, range_separator = '-', convert_to_tuple = True):
    ''' 
    '''
    result = map(sorted,
       map(lambda r:
            (int(r.split(range_separator)[0]), int(r.split(range_separator)[1])) if range_separator in r
            else (int(r), int(r)),
            s.split(',')))
    if convert_to_tuple:
        return tuple(map(tuple, result))
    return result