Convert number to base26 column string for excel. lang perl [duplicate]
Possible Duplicate:
How to convert a column number (eg. 127) into an excel column (eg. AA)
How convert number to base26 column string for excel. lang perl
Number::Latin
If it's something quick and dirty, the following sub may be useful.
sub column2base26 {
my $column = shift;
die "Column $column must be positive" unless $column > 0;
my $string = 'A';
$string++ for 2..$column;
return $string;
}
print column2base26($_), "\n" foreach (23, 15, 333);
# Output:
# W
# O
# LU
精彩评论