GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  MATH::STRING::SEQUENCE (3)

.ds Aq ’

NAME

Math::String::Sequence - defines a sequence (range) of Math::String(s)

CONTENTS

SYNOPSIS



        use Math::String::Sequence;
        use Math::String::Charset;

        $seq = Math::String::Sequence->new( a, zzz );              # set a-z
        $seq = Math::String::Sequence->new( a, zzz, [z..a] );  # set z..a
        $seq = Math::String::Sequence->new(
          { first => a, last => zzz, charset => [z..a]
          } );                                                     # same
        $x = Math::String->new(a);
        $y = Math::String->new(zz);
        $seq = Math::String::Sequence->new( {
          first => $x, last => $y, } );                            # same

        print "length: ",$seq->length(),"\n";
        print "first: ",$seq->first(),"\n";
        print "last: ",$seq->last(),"\n";
        print "5th: ",$seq->string(5),"\n";    
        print "out-of-range: ",$seq->string(10000000),"\n";        # undef     
       
        print "as array:: ",$seq->as_array(),"\n";                 # as array



REQUIRES

perl5.005, Exporter, Math::BigInt, Math::String, Math::String::Charset

EXPORTS

Exports nothing on default, but can export sequence().

DESCRIPTION

This module creates a sequence, or range of Math::Strings. Given a <B>firstB> and <B>lastB> string it represents all strings in between, including <B>firstB> and <B>lastB>. The sequence can be reversed, unlike ’A’..’Z’, which needs the first argument be smaller than the second.
Default charset The default charset is the set containing abcdefghijklmnopqrstuvwxyz (thus producing always lower case output). If either first or last is not an Math::String, they will get the given charset or this default.

USEFULL METHODS

BInew()



            new();



Create a new Math::String::Sequence object. Arguments are the first and last string, and optional charset. You can give a hash ref, that must then contain the keys first, last and charset.

BIlength()



            $sequence->length();



Returns the amount of strings this sequence contains, aka (last-first)+1.

BIis_reversed()



            $sequence->is_reversed();



Returns true or false, depending wether the first string in the sequence is smaller than the last.

BIfirst()



            $sequence->first($length);



Return the first string in the sequence. The optional argument becomes the new first string.

BIlast()



            $sequence->last($length);



Return the last string in the sequence. The optional argument becomes the new last string.

BIcharset()



            $sequence->charset();



Return a reference to the charset of the Math::String::Sequence object.

BIstring()



            $sequence->string($n);



Returns the Nth string in the sequence, 0 beeing the first. Negative arguments count backward from last, just like with arrays.

BIas_array()



            @array = $sequence->as_array();



Returns the sequence as array of strings. Usefull for emulating things like



        foreach (a..z)
          {
          print "$_\n";
          }



via



        my $sequence = Math::String::Sequence->new(foo,bar);

        foreach ($sequence->as_array())
          {
          print "$_\n";
          }



Beware, might create HUGE arrays!

BUGS

None discovered yet.

LICENSE

This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

If you use this module in one of your projects, then please email me. I want to hear about how my code helps you ;)

This module is (C) Tels http://bloodgate.com 2001 - 2005.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 MATH::STRING::SEQUENCE (3) 2005-01-01

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.