/clmconv

A golang package for converting to spreadsheet column alphabet or integer

Primary LanguageGoMIT LicenseMIT

clmconv

GoDoc CI codecov MIT License

A golang package for converting to spreadsheet column alphabet or integer.

Usage

Default converter

i, err := clmconv.Atoi("A") // i = 0
i := clmconv.MustAtoi("a") // i = 0
a := clmconv.Itoa(0) // a = "A"

Custom converter

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"

Example

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

References