Thread Excel Spaltenbuchstaben in Zahl umwandeln
(4 answers)
Opened by Kean at 2017-05-15 11:17
Sowas in der Art?
Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 my @test = qw(A B Z AA AC BA ABC); sub SIZE_ALPHABET() { scalar (() = 'A'..'Z') } for my $test (@test) { my $num = 0; for my $idx (0..length($test) -1) { my $char = substr($test, -$idx-1, 1); $num += ((ord($char) - ord('A') + 1) * (SIZE_ALPHABET ** $idx)); } say "$test = $num"; } 1 + 1 = 10
|