NAME

Range::Object::String - Implements string collections with Range::Object API

SYNOPSIS

use Range::Object::String;

# Create a new collection
my $range = Range::Object::String->new('foo bar', 'qux');

# Test if a value is in range
print "in range\n"     if  $range->in('foo');
print "not in range\n" if !$range->in('baz');

# Add values to range
$range->add('baz');

# Get sorted full list of values
my @list = $range->range();
print join q{ }, @list;         # Prints 'baz foo bar qux'

# Get sorted list of strings separated with "\n"
my $string = eval{ $range->range() };
print "$string"                 # Prints: baz
                                #         foo bar
                                #         qux

# Get range size
my $size = $range->size();
print "$size\n";                # Prints: 4

DESCRIPTION

String ranges are not true ranges, more like collections. All strings in the "range" are separate values and can be never collapsed. Default separators are \r, \n and \t.

METHODS

See Range::Object.

BUGS AND LIMITATIONS

Input strings cannot contain line feeds, newline and tab characters as these are used as list separators.

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.