无为清净楼资源网 Design By www.qnjia.com
复制代码 代码如下:
function chineseFirst($str)
{
$str= iconv("UTF-8","gb2312", $str); //如果程序是gbk的,此行就要注释掉
//判断字符串是否全都是中文
if (preg_match("/^[\x7f-\xff]/", $str))
{
$fchar=ord($str{0});
if($fchar>=ord("A") and $fchar<=ord("z") )return strtoupper($str{0});
$a = $str;
$val=ord($a{0})*256+ord($a{1})-65536;
if($val>=-20319 and $val<=-20284)return "A";
if($val>=-20283 and $val<=-19776)return "B";
if($val>=-19775 and $val<=-19219)return "C";
if($val>=-19218 and $val<=-18711)return "D";
if($val>=-18710 and $val<=-18527)return "E";
if($val>=-18526 and $val<=-18240)return "F";
if($val>=-18239 and $val<=-17923)return "G";
if($val>=-17922 and $val<=-17418)return "H";
if($val>=-17417 and $val<=-16475)return "J";
if($val>=-16474 and $val<=-16213)return "K";
if($val>=-16212 and $val<=-15641)return "L";
if($val>=-15640 and $val<=-15166)return "M";
if($val>=-15165 and $val<=-14923)return "N";
if($val>=-14922 and $val<=-14915)return "O";
if($val>=-14914 and $val<=-14631)return "P";
if($val>=-14630 and $val<=-14150)return "Q";
if($val>=-14149 and $val<=-14091)return "R";
if($val>=-14090 and $val<=-13319)return "S";
if($val>=-13318 and $val<=-12839)return "T";
if($val>=-12838 and $val<=-12557)return "W";
if($val>=-12556 and $val<=-11848)return "X";
if($val>=-11847 and $val<=-11056)return "Y";
if($val>=-11055 and $val<=-10247)return "Z";
} else
{
return false;
}
}
function chineseFirst($str)
{
$str= iconv("UTF-8","gb2312", $str); //如果程序是gbk的,此行就要注释掉
//判断字符串是否全都是中文
if (preg_match("/^[\x7f-\xff]/", $str))
{
$fchar=ord($str{0});
if($fchar>=ord("A") and $fchar<=ord("z") )return strtoupper($str{0});
$a = $str;
$val=ord($a{0})*256+ord($a{1})-65536;
if($val>=-20319 and $val<=-20284)return "A";
if($val>=-20283 and $val<=-19776)return "B";
if($val>=-19775 and $val<=-19219)return "C";
if($val>=-19218 and $val<=-18711)return "D";
if($val>=-18710 and $val<=-18527)return "E";
if($val>=-18526 and $val<=-18240)return "F";
if($val>=-18239 and $val<=-17923)return "G";
if($val>=-17922 and $val<=-17418)return "H";
if($val>=-17417 and $val<=-16475)return "J";
if($val>=-16474 and $val<=-16213)return "K";
if($val>=-16212 and $val<=-15641)return "L";
if($val>=-15640 and $val<=-15166)return "M";
if($val>=-15165 and $val<=-14923)return "N";
if($val>=-14922 and $val<=-14915)return "O";
if($val>=-14914 and $val<=-14631)return "P";
if($val>=-14630 and $val<=-14150)return "Q";
if($val>=-14149 and $val<=-14091)return "R";
if($val>=-14090 and $val<=-13319)return "S";
if($val>=-13318 and $val<=-12839)return "T";
if($val>=-12838 and $val<=-12557)return "W";
if($val>=-12556 and $val<=-11848)return "X";
if($val>=-11847 and $val<=-11056)return "Y";
if($val>=-11055 and $val<=-10247)return "Z";
} else
{
return false;
}
}
标签:
php,中文字符串,首字母
无为清净楼资源网 Design By www.qnjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
无为清净楼资源网 Design By www.qnjia.com
暂无评论...
更新日志
2024年11月15日
2024年11月15日
- 廖也欧《面朝大海》[Hi-Res][24bit 48kHz][FLAC/分轨][170.14MB]
- s13T1夺冠五人名单都有谁 s13T1夺冠五人名单一览
- 英雄联盟T1战队队长都有谁 T1战队所有队长介绍
- skt历届战队成员都有哪些 skt历届战队成员名单盘点
- 妙音唱片《大热唱片3》[WAV+CUE]
- 费玉清《跟着地球旋转》滚石时代经典复刻[正版原抓WAV+CUE]
- 罗文甄妮-射雕英雄传(AMCD)(限量版)[WAV+CUE]
- 《巫师4》定档2025再添佐证:参演人员曝光 老将回归
- 辣眼睛 美女COS《黑神话:悟空》比基尼版金池长老
- 外媒称PS5pro违背承诺:《蜘蛛侠2》根本没法4K60帧
- 令晴 Lynn《The Make》[320K/MP3][44.47MB]
- 令晴 Lynn《The Make》[Hi-Res][24bit 48kHz][FLAC/分轨][295.42MB]
- 雷婷《移情别恋HQⅡ》头版限量编号[低速原抓WAV+CUE][1G]
- FUNDAMENTAL.1989-感觉号渡轮【SONY】【WAV+CUE】
- 上山安娜.1986-上山安娜【EMI百代】【WAV+CUE】