github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/utils/humannumbers/columnletter.go (about)

     1  package humannumbers
     2  
     3  // ColumnLetter takes an int and converts it to an Excel-style column letter
     4  // reference (eg `C` or `AB`)
     5  func ColumnLetter(i int) string {
     6  	var col string
     7  
     8  	for i >= 0 {
     9  		mod := i % 26
    10  		col = string([]byte{byte(mod) + 65}) + col
    11  		i = ((i - mod) / 26) - 1
    12  	}
    13  
    14  	return col
    15  }