Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

got the range convertz working

  • Loading branch information...
commit 5799cc7e965d4e6dc3ec949fcb4b3d656ea0ea2d 1 parent 789e399
@josh3ennett authored
Showing with 14 additions and 9 deletions.
  1. +14 −9 src/ExcelFormulaUtilities.js
View
23 src/ExcelFormulaUtilities.js
@@ -666,16 +666,21 @@
}
// Pass in the base 26 string, get back integer
- function fromBase26(strAlphaNumber) {
- var s = 1
- , aMatch = /[a-z]+/gi
- , i = 0;
+ function fromBase26(number) {
+ number = number.toUpperCase();
- if ( aMatch.test(strAlphaNumber) ) {
- s = ( strAlphaNumber.charCodeAt(0) - ("A".charCodeAt(0) - 1) );
- for (; i < strAlphaNumber.length; i++) {
- s *= 26;
- s += (strAlphaNumber.charCodeAt(i) - "A".charCodeAt(0));
+ var s = 0
+ ,i = 1;
+
+ if (
+ number !== null
+ && typeof number !== "undefined"
+ && number.length > 0
+ ) {
+ s = (number.charCodeAt(0) - "A".charCodeAt(0));
+ for (; i < number.length; i++) {
+ s = s === 0 ? 26 : s * 26;
+ s += (number.charCodeAt(i) - ("A".charCodeAt(0) ));
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.