{"id":294,"date":"2009-04-06T13:18:00","date_gmt":"2009-04-06T05:18:00","guid":{"rendered":""},"modified":"2013-11-18T20:58:17","modified_gmt":"2013-11-18T12:58:17","slug":"%e5%b0%86%e6%b1%89%e5%ad%97%e7%bf%bb%e8%af%91%e6%88%90%e6%8b%bc%e9%9f%b3%e7%bc%a9%e5%86%99%e7%9a%84%e5%87%bd%e6%95%b0","status":"publish","type":"post","link":"https:\/\/kyle.ai\/blog\/294.html","title":{"rendered":"\u5c06\u6c49\u5b57\u7ffb\u8bd1\u6210\u62fc\u97f3\u7f29\u5199\u7684\u51fd\u6570"},"content":{"rendered":"<pre class=\"brush: delphi; title: ; notranslate\" title=\"\">\r\nfunction GetPyChar(const HZ: AnsiString): string;\r\nconst\r\nHZCode: array&#x5B;0..25, 0..1] of Integer = ((1601, 1636), (1637, 1832), (1833, 2077),\r\n    (2078, 2273), (2274, 2301), (2302, 2432), (2433, 2593), (2594, 2786), (9999, 0000),\r\n    (2787, 3105), (3106, 3211), (3212, 3471), (3472, 3634), (3635, 3722), (3723, 3729),\r\n    (3730, 3857), (3858, 4026), (4027, 4085), (4086, 4389), (4390, 4557), (9999, 0000),\r\n    (9999, 0000), (4558, 4683), (4684, 4924), (4925, 5248), (5249, 5589));\r\nvar\r\ni,j,HzOrd: Integer;\r\nbegin\r\ni := 1;\r\nwhile i &lt;= Length(HZ) do\r\n    begin\r\n    if (HZ&#x5B;i] &gt;= #160) and (HZ&#x5B;i + 1] &gt;= #160) then\r\n    begin\r\n      HzOrd := (Ord(HZ&#x5B;i]) \u2013 160) * 100 + Ord(HZ&#x5B;i + 1]) \u2013 160;\r\n      for j := 0 to 25 do\r\n      begin\r\n        if (HzOrd &gt;= HZCode&#x5B;j]&#x5B;0]) and (HzOrd &lt;= HZCode&#x5B;j]&#x5B;1]) then\r\n        begin\r\n          Result := Result + Char(Byte(\u2018A\u2019) + j);\r\n          Break;\r\n        end;\r\n      end;\r\n      Inc(i);\r\n    end else Result := Result + HZ&#x5B;i];\r\n      Inc(i);\r\nend;\r\nend;\r\n\r\n\/\/\u6d4b\u8bd5\uff1a\r\nprocedure TForm1.Button1Click(Sender: TObject);\r\nbegin\r\nShowMessage(GetPyChar(\u2018\u9f99\u5728\u5929)); \/\/\u7ed3\u679c\uff1a\r\n\r\nend;\r\n\r\n\/\/\u53ea\u5355\u72ec\u6c49\u5b57\uff1a\r\nfunction GetPyFitstChar(HZ: AnsiString): Char;\r\nbegin\r\ncase LoWord(HZ&#x5B;1]) shl 8 + LoWord(HZ&#x5B;2]) of\r\n    $B0A1..$B0C4: Result := \u2018A\u2019;\r\n    $B0C5..$B2C0: Result := \u2018B\u2019;\r\n    $B2C1..$B4ED: Result := \u2018C\u2019;\r\n    $B4EE..$B6E9: Result := \u2018D\u2019;\r\n    $B6EA..$B7A1: Result := \u2018E\u2019;\r\n    $B7A2..$B8C0: Result := \u2018F\u2019;\r\n    $B8C1..$B9FD: Result := \u2018G\u2019;\r\n    $B9FE..$BBF6: Result := \u2018H\u2019;\r\n    $BBF7..$BFA5: Result := \u2018J\u2019;\r\n    $BFA6..$C0AB: Result := \u2018K\u2019;\r\n    $C0AC..$C2E7: Result := \u2018L\u2019;\r\n    $C2E8..$C4C2: Result := \u2018M\u2019;\r\n    $C4C3..$C5B5: Result := \u2018N\u2019;\r\n    $C5B6..$C5BD: Result := \u2018O\u2019;\r\n    $C5BE..$C6D9: Result := \u2018P\u2019;\r\n    $C6DA..$C8BA: Result := \u2018Q\u2019;\r\n    $C8BB..$C8F5: Result := \u2018R\u2019;\r\n    $C8F6..$CBF9: Result := \u2018S\u2019;\r\n    $CBFA..$CDD9: Result := \u2018T\u2019;\r\n    $CDDA..$CEF3: Result := \u2018W\u2019;\r\n    $CEF4..$D188: Result := \u2018X\u2019;\r\n    $D1B9..$D4D0: Result := \u2018Y\u2019;\r\n    $D4D1..$D7F9: Result := \u2018Z\u2019;\r\nelse\r\n    Result := Char(0);\r\nend;\r\nend;\r\n\r\n\/\/\u6d4b\u8bd5\uff1a\r\nprocedure TForm1.Button1Click(Sender: TObject);\r\nbegin\r\nShowMessage(GetPyFitstChar\u2019\u9f99\u5728\u5929\u2018)); \/\/\u7ed3\u679c\uff1aL\r\n\r\nend;\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>function GetPyChar(const HZ: AnsiString): string; const [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-294","post","type-post","status-publish","format-standard","hentry","category-code_related"],"_links":{"self":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/294","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/comments?post=294"}],"version-history":[{"count":1,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/294\/revisions"}],"predecessor-version":[{"id":4787,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/294\/revisions\/4787"}],"wp:attachment":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/media?parent=294"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/categories?post=294"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/tags?post=294"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}