
com.ecfront.easybi.excelconverter.inner.util.UnitConvertHelper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ez-excelconverter Show documentation
Show all versions of ez-excelconverter Show documentation
Simple Java and Excel conversion tools.
package com.ecfront.easybi.excelconverter.inner.util;
/**
* Unit Convert Helper
*
* @author gudaoxuri
*/
public class UnitConvertHelper {
/**
* Convert 26 TO 10 ,Use word TO number
*/
public static int convert26to10(String s) {
if (null != s && !"".equals(s)) {
int n = 0;
char[] tmp = s.toCharArray();
for (int i = tmp.length - 1, j = 1; i >= 0; i--, j *= 26) {
char c = Character.toUpperCase(tmp[i]);
if (c < 'A' || c > 'Z') return 0;
n += ((int) c - 64) * j;
}
return n;
}
return 0;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy