Skip to content

Instantly share code, notes, and snippets.

@pandanote-info
Created October 19, 2019 02:44
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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