本文整理自网络,侵删。
uses StrUtils;
function GetCharSpellCode(cnStr: string): string;var buf: TBytes; i: Integer; icnStrCount: Int64; i1, i2: Integer; tmpStr: string[4];begin Result := ''; // TODO -cMM: TForm1.GetCharSpellCode default body inserted SetLength(buf, 4); // tmpStr := cnStr; for i := 0 to 3 do buf[i] := Byte(tmpStr[i]);
i1 := int16(buf[1]); i2 := int16(buf[2]); icnStrCount := i1 * 256 + i2; if (icnStrCount >= 45217) and (icnStrCount <= 45252) then begin Result := 'A'; Exit; end; if (icnStrCount >= 45253) and (icnStrCount <= 45760) then begin Result := 'B'; Exit; end;
if (icnStrCount >= 45761) and (icnStrCount <= 46317) then begin Result := 'C'; Exit; end;
if (icnStrCount >= 46318) and (icnStrCount <= 46825) then begin Result := 'D'; Exit; end;
if (icnStrCount >= 46826) and (icnStrCount <= 47009) then begin Result := 'E'; Exit; end;
if (icnStrCount >= 47010) and (icnStrCount <= 47296) then begin Result := 'F'; Exit; end;
if (icnStrCount >= 47297) and (icnStrCount <= 47613) then begin Result := 'G'; Exit; end;
if (icnStrCount >= 47614) and (icnStrCount <= 48118) then begin Result := 'H'; Exit; end;
if (icnStrCount >= 48119) and (icnStrCount <= 49061) then begin Result := 'J'; Exit; end;
if (icnStrCount >= 49062) and (icnStrCount <= 49323) then begin Result := 'K'; Exit; end;
if (icnStrCount >= 49324) and (icnStrCount <= 49895) then begin Result := 'L'; Exit; end; if (icnStrCount >= 49896) and (icnStrCount <= 50370) then begin Result := 'M'; Exit; end; if (icnStrCount >= 50371) and (icnStrCount <= 50613) then begin Result := 'N'; Exit; end; if (icnStrCount >= 50614) and (icnStrCount <= 50621) then begin Result := 'O'; Exit; end; if (icnStrCount >= 50622) and (icnStrCount <= 50905) then begin Result := 'P'; Exit; end; if (icnStrCount >= 50906) and (icnStrCount <= 51386) then begin Result := 'Q'; Exit; end; if (icnStrCount >= 51387) and (icnStrCount <= 51445) then begin Result := 'R'; Exit; end; if (icnStrCount >= 51446) and (icnStrCount <= 52217) then begin Result := 'S'; Exit; end; if (icnStrCount >= 52218) and (icnStrCount <= 52697) then begin Result := 'T'; Exit; end; if (icnStrCount >= 52698) and (icnStrCount <= 52979) then begin Result := 'W'; Exit; end; if (icnStrCount >= 52980) and (icnStrCount <= 53688) then begin Result := 'X'; Exit; end; if (icnStrCount >= 53689) and (icnStrCount <= 54480) then begin Result := 'Y'; Exit; end; if (icnStrCount >= 54481) and (icnStrCount <= 55289) then begin Result := 'Z'; Exit; end; Result := UpperCase(cnStr);end;
相关阅读 >>
Delphi fdconnection1.gettablenames 查看所有表包含用户表和系统表
Delphi 接口尚未调用尚未调用coinitialize解决办法
Delphi tbitmap创建时提示object or class type required
Delphi tnethttpclient https忽略证书验证
更多相关阅读请进入《Delphi》频道 >>