用递归得到Execl的列头字符

来源:互联网 发布:工业控制软件界面 编辑:程序博客网 时间:2024/06/06 14:02
/** * 根据assii码获得字符 * @param assii (assii要大于0) * @return */private String getChar(int assii){String str = "";String[] c = {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"};int x = 0;int y = 0;if(assii%26==0){x = assii/26;if(x > 26){str=getChar(x-1)+c[25];}else if(x == 1){str = c[25];}else{str =getChar(x-1)+c[25];}}else{x = (int)MathUtils.roundDown(assii/26.0, 0);if(x > 26){str=getChar(x);}else if(x > 0){str = c[x-1];}y = assii%26;str = str+c[y-1];}return str;}

0 0
原创粉丝点击