PHP 实现数字转字母,生成Excel列标
来源:互联网 发布:论文抄袭软件 编辑:程序博客网 时间:2024/09/21 08:19
/**
* 数字转字母 (类似于Excel列标)
* @param Int $index 索引值
* @param Int $start 字母起始值
* @return String 返回字母
*/
function IntToChr($index, $start = 65) {
$str = '';
if (floor($index / 26) > 0) {
$str .= IntToChr(floor($index / 26)-1);
}
return $str . chr($index % 26 + $start);
}
/**
* 测试
*/
function test() {
echo IntToChr(0); //# A
echo IntToChr(1); //# B
// ...
echo IntToChr(27); //# AB
}
* 数字转字母 (类似于Excel列标)
* @param Int $index 索引值
* @param Int $start 字母起始值
* @return String 返回字母
*/
function IntToChr($index, $start = 65) {
$str = '';
if (floor($index / 26) > 0) {
$str .= IntToChr(floor($index / 26)-1);
}
return $str . chr($index % 26 + $start);
}
/**
* 测试
*/
function test() {
echo IntToChr(0); //# A
echo IntToChr(1); //# B
// ...
echo IntToChr(27); //# AB
}
阅读全文
0 0
- PHP 实现数字转字母,生成Excel列标
- C# Excel数字转字母列标
- excel列字母数字表示互转
- excel中列字母和数字互换
- 将excel列号字母改为数字
- 数字转Excel列标
- Excel列序号生成字母表示
- Excel中列数字与字母的转换(JAVA实现)
- PHP生成随机字符串(字母+数字)
- php 随机生成数字字母组合
- php 随机生成数字字母组合
- PHP生成随机字符串(字母+数字)
- Excel行列数字字母转换实现
- excel列数由数字转为字母形式
- 字母和数字的转换——Excel列名
- 字母和数字的转换——Excel列名
- C#中 Excel列字母与数字的转换
- VBA实现数字列与字母列的相互转化
- 关于显著性检验,你想要的都在这儿了!!(基础篇)
- Vue+Django REST framework 打造生鲜电商项目
- 让bootstrap表格自动出现水平滚动条
- 上传文件(jq,php)
- qt复杂操作保持响应
- PHP 实现数字转字母,生成Excel列标
- android http 同步请求
- java 远程连接hadoop集群
- 欢迎使用CSDN-markdown编辑器
- JS时间处理插件MomentJS
- mac下idea中没有maven的问题
- squid,Varnish,nginx cache,ats,btw 区别
- lintcode第一题 A+B问题
- 17年将至,一个来自25岁程序员的迷茫