zoukankan      html  css  js  c++  java
  • Delphi中取得汉字的首字母(十分巧妙)

    function Tdm.GetHzPy(const AHzStr: string): string;
    const
      ChinaCode: array[0..25, 0..1] of Integer = ((1601, 1636), (1637, 1832), (1833, 2077),
      (2078, 2273), (2274, 2301), (2302, 2432), (2433, 2593), (2594, 2786), (9999, 0000),
      (2787, 3105), (3106, 3211), (3212, 3471), (3472, 3634), (3635, 3722), (3723, 3729),
      (3730, 3857), (3858, 4026), (4027, 4085), (4086, 4389), (4390, 4557), (9999, 0000),
      (9999, 0000), (4558, 4683), (4684, 4924), (4925, 5248), (5249, 5589));
    var
        i, j, HzOrd: integer;
    //    Hz: string[2];
    begin
        i :=1;
        while i <= Length(AHzStr) do
        begin
            if (AHzStr[i] >= #160) and (AHzStr[i +1] >= #160) then
            begin
                HzOrd := (Ord(AHzStr[i]) -160) *100+ Ord(AHzStr[i +1]) -160;
                for j :=0 to 25do
                begin
                    if (HzOrd >= ChinaCode[j][0]) and (HzOrd <= ChinaCode[j][1]) then
                    begin
                        Result := Result +char(byte('A') + j);
                        break;
                    end;
                end;
                Inc(i);
            end else Result := Result + AHzStr[i];
            Inc(i);
        end;
    end;

    http://www.cnblogs.com/hssbsw/archive/2012/12/04/2801958.html

  • 相关阅读:
    SLS评测报告
    Flash对不同的浏览器的兼容性
    NodeJS的Cluster模块使用
    Varnish+Xcache构建高性能WEB构架初探
    Memcached Client的释疑
    Firebug及YSlow简介与使用图文详解
    PHP Memcached 实现简单数据库缓存
    PHP + Memcache 实现Session共享
    Linux 开机关机在线求助与指令输入
    Linux 基础学习篇笔记 Linux基础知识
  • 原文地址:https://www.cnblogs.com/findumars/p/6359770.html
Copyright © 2011-2022 走看看