String::Splitter - Find all possible string splits and unique substrings.


String-Splitter documentation  | view source Contained in the String-Splitter distribution.

Index


NAME

Top

String::Splitter - Find all possible string splits and unique substrings.

VERSION

Top

Version 0.4

SYNOPSIS

Top

Find all possible string splits and unique substrings.

    use String::Splitter;

    my $ss = String::Splitter->new();

    my $all_splits = $ss->all_splits("ABCD");

    # $all_splits == [
    #     [ 'A',   'B', 'C', 'D' ],
    #     [ 'AB',  'C', 'D' ],
    #     [ 'A',   'B', 'CD' ],
    #     [ 'ABC', 'D' ],
    #     [ 'A',  'BC', 'D' ],
    #     [ 'AB', 'CD' ],
    #     [ 'A',  'BCD' ],
    #     [ 'ABCD' ]
    # ]

    my $all_substrings = $ss->all_substrings("ABCA");

    # $all_substrings == [
    #     'A',
    #     'ABC',
    #     'BC',
    #     'ABCA',
    #     'B',
    #     'BCA',
    #     'C',
    #     'CA',
    #     'AB'
    # ];




UTF SUPPORT

Module is utf8 safe. You can

    my $results = $ss->all_splits("☺☻");

to get

    [
        [ '☺',  '☻' ],
        [ '☺☻' ]
    ]

MEMORY WARNING

Amount of possible splits is equal to

    2 ** ( length($string) -1)

so be careful with length as this grows REALLY fast!!

FUNCTIONS

Top

new

Creates new object.

all_splits

    my $results = $ss->all_splits("ABCD");

Returns ArrayRef of ArrayRefs with all possible splits.

Carp::confess will be called if param is missing or zero length.

all_substrings

    my $results = $ss->unique_substrings("AABCDAA");

Returns ArrayRef of all possible unique substrings.

Carp::confess will be called if param is missing or zero length.

AUTHOR

Top

Pawel (bbkr) Pabian, <cpan at bbkr.org>

Private website: http://bbkr.org

Company website: http://implix.com

BUGS

Top

Please report any bugs or feature requests to bug-string-splitter at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=String-Splitter. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

Top

You can find documentation for this module with the perldoc command.

    perldoc String::Splitter




You can also look for information at:

* RT: CPAN's request tracker

http://rt.cpan.org/NoAuth/Bugs.html?Dist=String-Splitter

* AnnoCPAN: Annotated CPAN documentation

http://annocpan.org/dist/String-Splitter

* CPAN Ratings

http://cpanratings.perl.org/d/String-Splitter

* Search CPAN

http://search.cpan.org/dist/String-Splitter

ACKNOWLEDGEMENTS

Top

COPYRIGHT & LICENSE

Top


String-Splitter documentation  | view source Contained in the String-Splitter distribution.