The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Range::DigitString - Implements ranges of digit strings

SYNOPSIS

 use Range::DigitString;
 
 # Create a new range
 my $range = Range::DigitString->new('00-03; 0100-0103', '996-998');
 
 # Test if a value is in range
 print "in range\n"     if  $range->in('02');
 print "not in range\n" if !$range->in('999');
 
 # Add values to range
 $range->add('04', '0104', '999');
 
 # Get full list of values
 my @list = $range->range();
 print join q{ }, @list;
 # Prints:
 # 00 01 02 03 04 0100 0101 0102 0103 0104 996 997 998 999
 
 # Get collapsed string representation
 my $string = $range->range();
 print "$string\n";
 # Prints:
 # '00-04,0100-0104,996-999'
 
 # Get range size
 my $size = $range->size();
 print "$size";                  # Prints: 14

DESCRIPTION

This module is intended to be used with ranges of digit strings up to 16 digits in length.

METHODS

See Range::Object.

BUGS AND LIMITATIONS

There are no known bugs in this module. Please report problems to author, patches are welcome.

AUTHOR

Alexander Tokarev <tokarev@cpan.org>.

LICENSE AND COPYRIGHT

Copyright (c) 2011 Alexander Tokarev.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.