Text::NumericListText::NumericList is a Perl extension for converting strings into arrays of positive integers and vice-versa. | |
Download |
Text::NumericList Ranking & Summary
Advertisement
- License:
- Perl Artistic License
- Price:
- FREE
- Publisher Name:
- Arkady Grudzinsky
- Publisher web site:
- http://search.cpan.org/~grudziar/Text-NumericList-0.01/NumericList.pm
Text::NumericList Tags
Text::NumericList Description
Text::NumericList is a Perl extension for converting strings into arrays of positive integers and vice-versa. Text::NumericList is a Perl extension for converting strings into arrays of positive integers and vice-versa.SYNOPSIS use Text::NumericList; my $list = Text::NumericList->new;Converting arrays into strings $list->set_array(1,2,3,5,6,7); my $string = $list->get_string; # Returns '1-3,5-7' $list->set_output_separator(';'); $string = $list->get_string; # Returns '1-3;5-7' $list->set_range_symbol('..'); $string = $list->get_string; # Returns '1..3;5..7'Converting strings into arrays $list->set_string('1-3,5-7'); my @array = $list->get_array; # Returns (1,2,3,5,6,7) $list->set_range_regexp('.+'); # Set range regular expression to # a single or multiple periods $list->set_string('1..3,5...7'); @array = $list->get_array; # Returns (1,2,3,5,6,7) Additional methods my $mask = new Text::NumericList; $mask->set_string('1-10,20-25'); $list->set_mask($mask); # Set the list maskMask limits the numeric list to certain values, so that get_string() and get_array() methods return intersection of the current list and the mask: $list->set_string('15-30'); @array = $list->get_array; # Returns (20,21,22,23,24,25) $string = $list->get_string; # Returns '20-25'The following shortcuts work if the mask is set. $list->set_string('18,odd'); @array = $list->get_array; # Returns (15,17-19,21,23,25,27,29) $list->set_string('21,even'); @array = $list->get_array; # Returns (16,18,20-22,24,26,28,30) $list->set_string('all'); $string = $list->get_string; # Returns '15-30'Requirements:· Perl Requirements: · Perl
Text::NumericList Related Software