Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A1形式の文字列をApache POIのgetRow及びgetCellメソッドの引数に指定できる数値の組(Tuple)に変換するためのScalaのメソッド。
// 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
You can’t perform that action at this time.