A golang package for converting to spreadsheet column alphabet or integer.
i, err := clmconv.Atoi("A") // i = 0
i := clmconv.MustAtoi("a") // i = 0
a := clmconv.Itoa(0) // a = "A"
converter := clmconv.New(clmconv.WithStartFromOne(), clmconv.WithLowercase())
i, err := converter.Atoi("A") // i = 1
i := converter.MustAtoi("a") // i = 1
a := converter.Itoa(1) // a = "a"
Alphabet | Integer | Integer (WithStartFromOne) |
---|---|---|
A | 0 | 1 |
B | 1 | 2 |
Z | 25 | 26 |
AA | 26 | 27 |
ZZ | 701 | 702 |
ABC | 730 | 731 |
ABCDE | 494264 | 494265 |