A1形式の文字列をApache POIのgetRow及びgetCellメソッドの引数に指定できる数値の組(Tuple)に変換するためのScalaのメソッド。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// See https://pandanote.info/?p=5424 for details. | |
def toRowCell(c: String, r: Int): (Int,Int) = { | |
var ci: Int = 0 | |
var power: Int = 1 | |
c.toCharArray.reverse.foreach(cr => { | |
ci += (cr-'A'+1)*power | |
power *= 26 | |
}) | |
(r-1,ci-1) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment