Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Alpha base-26 to base-10...

by sauoq (Abbot)
on Jul 01, 2003 at 00:15 UTC ( #270368=note: print w/replies, xml ) Need Help??


in reply to Alpha base-26 to base-10...

I'd prefer something more readable than concise. It's a concise enough problem anyway.

sub b26_to_b10 { my $base_10 = 0; for (split //, lc shift) { $base_10 *= 26; $base_10 += ord() - 96; } return $base_10; }
-sauoq
"My two cents aren't worth a dime.";

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://270368]
help
Chatterbox?
[Discipulus]: eh, at the end i cannot compete with brother choroba, i just profited he is at lunch
[pra]: What is the best way to determine if a given string is a valid color?
[Discipulus]: context pra? tk html console naturla language?
[Corion]: Or HTML color like #c0ffee ?
[pra]: Perl/Tk. I want to input a file that will contain color names, but users might not know what names are valid

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2017-10-17 11:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My fridge is mostly full of:

















    Results (226 votes). Check out past polls.

    Notices?