---
# System prepended metadata

title: \#171 Excel Sheet Column Number
tags: [leetcode, leetcode-easy]

---

# \#171 Excel Sheet Column Number
## *把excel的欄位編號轉為數字(26進位轉10進位)*
## Log
 - build 20210413 by syhuang

## 初見
 - 26進位轉10進位
```javascript=
var titleToNumber = function(columnTitle) {
    //codePointAt 'A' is 65
    columnTitle = columnTitle.split('');
    var pow = 0;
    var result = 0;
    while(columnTitle.length > 0){
        var chr = columnTitle.pop();
        result += Math.pow(26,pow)*(chr.codePointAt(0)-64);
        pow++;
    }
    return result;
};
```
## 備註
 - 學習javascript codePointAt用法:把字元轉為對應的UTF-16編碼
 - 與[#168](articles/Leetcode/easy/168.md)彼此為26進制互轉題目
 - 初見即畢業,參考其他人javascript寫法都大同小異
## 參考
###### tags: `leetcode`, `leetcode-easy`