Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/perl/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Perl 将数字转换为excel的base26列字符串。朗佩尔_Perl_Excel - Fatal编程技术网

Perl 将数字转换为excel的base26列字符串。朗佩尔

Perl 将数字转换为excel的base26列字符串。朗佩尔,perl,excel,Perl,Excel,可能重复: 如何将数字转换为excel的base26列字符串。lang perl如果它是快速而肮脏的东西,下面的子部分可能会有用 sub column2base26 { my $column = shift; die "Column $column must be positive" unless $column > 0; my $string = 'A'; $string++ for 2..$column; return $string; }

可能重复:


如何将数字转换为excel的base26列字符串。lang perl

如果它是快速而肮脏的东西,下面的子部分可能会有用

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

如果是又快又脏的东西,下面的sub可能会有用

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

这不是租一个编码器。你应该能够翻译这几行简单的文字。这不是租一个编码器。你应该能够翻译这几行简单的文字。