Created
February 6, 2023 19:08
-
-
Save ChrisDobby/0bb4fce64804e9c25f9fdceb59526b95 to your computer and use it in GitHub Desktop.
Spreadsheet programs often use the A1 Reference Style to refer to columns. Given a column name in this style, return its column number.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const colNamesToNumbers = (name: string) => name.split('').reduce((acc, ch) => acc * 26 + ch.charCodeAt(0) - 64, 0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment