Number::Latin 1.01 review

Download
by rbytes.net on

Number::Latin is a Perl module that can convert to/from the number system "a,b,...z,aa,ab..." SYNOPSIS use Number::Latin;

License: Perl Artistic License
File size: 5K
Developer: Sean M. Burke
0 stars award from rbytes.net

Number::Latin is a Perl module that can convert to/from the number system "a,b,...z,aa,ab..."

SYNOPSIS

use Number::Latin;
print join(' ', map int2latin($_), 1 .. 30), "n";
#
# Prints:
# a b c d e f g h i j k l m n o p q r s t u v w x y z aa ab ac ad

Some applications, notably the numbering of points in outlines, use a scheme that starts with the letter "a", goes to "z", and then starts over with "aa" thru "az", then "ba", and so on. (The W3C refers to this numbering system as "lower-latin"/"upper-latin" or "lower alpha"/"upper alpha", in discussions of HTML/CSS options for rendering of list elements (OL/LI).)

This module provides functions that deal with that numbering system, converting between it and integer values.

FUNCTIONS

This module exports four functions, int2latin, int2Latin, int2LATIN, and latin2int:

$latin = int2latin( INTEGER )

This returns the INTEGERth item in the sequence ('a' .. 'z', 'aa', 'ab', etc). For example, int2latin(1) is "a", int2latin(2) is "b", int2latin(26) is "z", int2latin(30) is "ad", and so for any nonzero integer.

$latin = int2Latin( INTEGER )

This is just like int2latin, except that the return value is has an initial capital. E.g., int2Latin(30) is "Ad".

$latin = int2LATIN( INTEGER )

This is just like int2latin, except that the return value is in all uppercase. E.g., int2LATIN(30) is "AD".

$latin = latin2int( INTEGER )

This converts back from latin number notation (regardless of capitalization!) to an integer value. E.g., latin2int("ad") is 30.

Requirements:
Perl

Number::Latin 1.01 search tags