码迷,mamicode.com
首页 > 其他好文 > 详细

Excel Sheet Column Number

时间:2015-01-14 22:41:44      阅读:243      评论:0      收藏:0      [点我收藏+]

标签:

1   public int titleToNumber(String s) {
2         if(s.length()==0) return 0;
3          int res=0;
4          for(int i=0;i<s.length();i++)
5          {
6              res+=(s.charAt(i)-‘A‘+1)*Math.pow(26, s.length()-i-1);
7          }
8         return res;
9     }

 

Excel Sheet Column Number

标签:

原文地址:http://www.cnblogs.com/sweetculiji/p/4224917.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!