/**
* String from columnindex
*
* @param int $pColumnIndex Column index (base 0 !!!)
* @return string
*/
public static function stringFromColumnIndex($pColumnIndex = 0)
{
// Using a lookup cache adds a slight memory overhead, but boosts speed
// caching using a static within the method is faster than a class static,
// though it's additional memory overhead
static $_indexCache = array(); if (!isset($_indexCache[$pColumnIndex])) {
// Determine column string
if ($pColumnIndex < 26) {
$_indexCache[$pColumnIndex] = chr(65 + $pColumnIndex);
} elseif ($pColumnIndex < 702) {
$_indexCache[$pColumnIndex] = chr(64 + ($pColumnIndex / 26)) .
chr(65 + $pColumnIndex % 26);
} else {
$_indexCache[$pColumnIndex] = chr(64 + (($pColumnIndex - 26) / 676)) .
chr(65 + ((($pColumnIndex - 26) % 676) / 26)) .
chr(65 + $pColumnIndex % 26);
}
}
return $_indexCache[$pColumnIndex];
}

最新文章

  1. 转:入门Webpack,看这篇就够了
  2. IOS学习笔记之获取Plist文件读取数据
  3. DB2常用命令
  4. SQL2008全部数据导出导入两种方法【转】
  5. C#调用脚本语言(三)-- IronJS 与 IronLua 简单方法性能比较
  6. Hybrid App开发者一定不要错过的框架和工具
  7. Linux RAR 安装和使用详细说明
  8. 【CKEditor ASP.NET】解决360安全浏览器极速模式下不显示
  9. 移植ffmpeg到VC环境心得
  10. 关于jsp页面 title中文乱码问题的解决方法
  11. Java 9 揭秘(14. HTTP/2 Client API)
  12. oracle中文乱码问题解决
  13. ubuntu Pycharm 2017 3.3 Active
  14. beta冲刺6/7
  15. docker 小结
  16. 设计 MySQL 数据表的时候一般都有一列为自增 ID,这样设计原因是什么,有什么好处?
  17. 非常精简的Linux线程池实现(一)——使用互斥锁和条件变量
  18. MySQL-慢查询日志
  19. django http404 详解
  20. linux网络配置练习

热门文章

  1. HCIP-ICT实战进阶05-路由策略与策略路由
  2. pandoc转换markdown生成pdf文件表格问题
  3. Lubuntu 18.04 自动登录
  4. 20203412马畅若 实验三 《Python程序设计》Socket编程技术实验报告
  5. 掌控安全学院SQL注入靶场-布尔盲注(一)
  6. API对象--Ingress(chrono《kubernetes入门实战课》笔记整理)
  7. git submodule .gitmodules 子模块
  8. QString的一些使用技巧
  9. python快速制作可视化报表
  10. Qt多线程编程之QThreadPool 和 QRunnable使用