Skip to content

Instantly share code, notes, and snippets.

@BlueZeeKing
Created May 7, 2025 14:57
Show Gist options
  • Select an option

  • Save BlueZeeKing/c7078b0f95a9863a8df4a60bbf4a7d5f to your computer and use it in GitHub Desktop.

Select an option

Save BlueZeeKing/c7078b0f95a9863a8df4a60bbf4a7d5f to your computer and use it in GitHub Desktop.
pub fn col_to_num(column_title: &str) -> i32 {
column_title
.chars()
.rev()
.map(|char| char as u8 - b'A' + 1)
.enumerate()
.map(|(idx, value)| 26i32.pow(idx as u32) * value as i32)
.sum::<i32>()
}
@Archonic944
Copy link

LGTM!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment