{"id":127,"date":"2008-11-01T10:17:00","date_gmt":"2008-11-01T02:17:00","guid":{"rendered":""},"modified":"2013-11-18T21:45:43","modified_gmt":"2013-11-18T13:45:43","slug":"delphi%e8%bf%9b%e5%88%b6%e8%bd%ac%e6%8d%a2","status":"publish","type":"post","link":"https:\/\/kyle.ai\/blog\/127.html","title":{"rendered":"Delphi\u8fdb\u5236\u8f6c\u6362"},"content":{"rendered":"<pre class=\"brush: delphi; title: ; notranslate\" title=\"\">\r\n\/\/\u5341\u516d\u8fdb\u5236(S)--&gt;&gt;\u5341\u8fdb\u5236(I) &#x5B;\u91cd\u5199:Jey]\r\nfunction hextoint(s: string): Integer;\r\nbegin \/\/$\u4ee3\u886816\u8fdb\u5236\r\nResult:=StrToInt('$'+s);\r\nend;\r\n\r\n\/\/\u5341\u8fdb\u5236\u8f6c\u6362\u4e3a\u4e8c\u8fdb\u5236\u5b57\u7b26\u4e32 &#x5B;\u91cd\u5199:Jey]\r\nfunction inttoBin(i: integer): string;\r\nbegin\r\nwhile i &lt;&gt;0 do\r\nbegin \/\/i mod 2\u53d6\u6a21,\u518d\u4f7f\u7528format\u683c\u5f0f\u5316\r\nresult:=Format('%d'+result,&#x5B;i mod 2]);\r\ni:=i div 2\r\nend\r\nend;\r\n\r\n\/\/\u4e8c\u8fdb\u5236(S)--&gt;&gt;\u5341\u8fdb\u5236(D) &#x5B;\u91cd\u5199:Jey]\r\nuses Math;\r\nfunction hextoint(s: string): Double;\r\nbegin\r\nwhile Length(s) &lt;&gt;0 do\r\nbegin \/\/2^(\u957f\u5ea6-1)\u6b21\u65b9\r\nif s&#x5B;1]='1' then Result:=Result+power(2,Length(s)-1);\r\ns:=Copy(s,2,Length(s));\r\nend\r\nend;\r\n\/\/\u5341\u8fdb\u5236(I)--&gt;&gt;\u5341\u516d\u8fdb\u5236(S)\r\n\/\/D\u81ea\u5e26\u51fd\u6570,Digits\u957f\u5ea6,\u4e00\u822c\u8bbe4.\r\nfunction IntToHex(Value: Integer; Digits: Integer): string;\r\n\r\n\/\/\u6570\u636e(S)--&gt;&gt;\u4e8c\u8fdb\u5236(S)\r\n\/\/\u4efb\u4f55\u6570\u636e\u90fd\u662f\u4ee5\u4e8c\u8fdb\u5236\u5f62\u5f0f\u5b58\u50a8\u7684\uff01 (\u8f6c)\r\nfunction conertde(s:string):string;\r\nvar\r\ni:integer;\r\nbegin\r\nfor i:=1 to length(s) do\r\nresult:=result+inttohex(ord(s&#x5B;i]),2);\r\nend;\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\/\/\u5341\u516d\u8fdb\u5236(S)&#8211;&gt;&gt;\u5341\u8fdb\u5236(I) &#x5B;\u91cd\u5199:Jey] function hextoi [&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-127","post","type-post","status-publish","format-standard","hentry","category-code_related"],"_links":{"self":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/127","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=127"}],"version-history":[{"count":1,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/127\/revisions"}],"predecessor-version":[{"id":4810,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/127\/revisions\/4810"}],"wp:attachment":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/media?parent=127"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/categories?post=127"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/tags?post=127"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}