{"id":1200,"date":"2021-10-15T22:44:08","date_gmt":"2021-10-15T14:44:08","guid":{"rendered":"http:\/\/www.haoht.com.cn\/?p=1200"},"modified":"2021-10-15T22:44:08","modified_gmt":"2021-10-15T14:44:08","slug":"%e8%b4%a2%e5%8a%a1%e4%b8%93%e7%94%a8%ef%bc%9a%e9%98%bf%e6%8b%89%e4%bc%af%e6%95%b0%e5%ad%97%e8%bd%ac%e4%b8%ad%e6%96%87%e5%a4%a7%e5%86%99%e9%87%91%e9%a2%9d%ef%bc%88%e6%94%af%e6%8c%81%e5%b0%8f%e6%95%b0","status":"publish","type":"post","link":"http:\/\/www.haoht.com.cn\/1200\/","title":{"rendered":"\u8d22\u52a1\u4e13\u7528\uff1a\u963f\u62c9\u4f2f\u6570\u5b57\u8f6c\u4e2d\u6587\u5927\u5199\u91d1\u989d\uff08\u652f\u6301\u5c0f\u6570\uff09"},"content":{"rendered":"
\u8d22\u52a1\u4e13\u7528\uff1a\u963f\u62c9\u4f2f\u6570\u5b57\u8f6c\u4e2d\u6587\u5927\u5199\u91d1\u989d\uff08\u652f\u6301\u5c0f\u6570\uff09<\/div>\n
— \u91d1\u989d\u5c0f\u5199\u6570\u5b57 \u6574\u6570\u5143 \u8f6c\u6362 \u4e2d\u6587\u5927\u5199<\/div>\n
\"\"<\/div>\n
function\u00a0 yuan_zh(szNum)<\/strong><\/div>\n
\u00a0 \u00a0 —\u963f\u62c9\u4f2f\u6570\u5b57\u8f6c\u4e2d\u6587\u5927\u5199<\/div>\n
\u00a0 \u00a0 local szChMoney = “”<\/div>\n
\u00a0 \u00a0 local iLen = 0<\/div>\n
\u00a0 \u00a0 local iNum = 0<\/div>\n
\u00a0 \u00a0 local iAddZero = 0<\/div>\n
\u00a0 \u00a0 local hzUnit = {“”, “\u62fe”, “\u4f70”, “\u4edf”, “\u4e07”, “\u62fe”, “\u4f70”, “\u4edf”, “\u4ebf”,”\u62fe”, “\u4f70”, “\u4edf”, “\u4e07”, “\u5341”, “\u767e”, “\u5343”}<\/div>\n
\u00a0 \u00a0 local hzNum = {“\u96f6”, “\u58f9”, “\u8d30”, “\u53c1”, “\u8086”, “\u4f0d”, “\u9646”, “\u67d2”, “\u634c”, “\u7396”}<\/div>\n
\u00a0 \u00a0 if nil == tonumber(szNum) then<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 return tostring(szNum)<\/div>\n
\u00a0 \u00a0 end<\/div>\n
\u00a0 \u00a0 iLen =string.len(szNum)<\/div>\n
\u00a0 \u00a0 if iLen > 10 or iLen == 0 or tonumber(szNum) < 0 then<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 return tostring(szNum)<\/div>\n
\u00a0 \u00a0 end<\/div>\n
\u00a0 \u00a0 for i = 1, iLen\u00a0 do<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 iNum = string.sub(szNum,i,i)<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 if iNum == 0 and i ~= iLen then<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 iAddZero = iAddZero + 1<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 else<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 if iAddZero > 0 then<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 szChMoney = szChMoney..hzNum[1]<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 end<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 szChMoney = szChMoney..hzNum[iNum + 1] –\/\/\u8f6c\u6362\u4e3a\u76f8\u5e94\u7684\u6570\u5b57<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 iAddZero = 0<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 end<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 if (iAddZero < 4) and (0 == (iLen – i) % 4 or 0 ~= tonumber(iNum)) then<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 szChMoney = szChMoney..hzUnit[iLen-i+1]<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 end<\/div>\n
\u00a0 \u00a0 end<\/div>\n
\u00a0 \u00a0 local function removeZero(num)<\/strong><\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 –\u53bb\u6389\u672b\u5c3e\u591a\u4f59\u7684 \u96f6<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 num = tostring(num)<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 local szLen = string.len(num)<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 local zero_num = 0<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 for i = szLen, 1, -3 do<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 szNum = string.sub(num,i-2,i)<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 if szNum == hzNum[1] then<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 zero_num = zero_num + 1<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 else<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 break<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 end<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 end<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 num = string.sub(num, 1,szLen – zero_num * 3)<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 szNum = string.sub(num, 1,6)<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 — \u5f00\u5934\u7684 “\u4e00\u5341” \u8f6c\u6210 “\u5341” , \u8d34\u8fd1\u4eba\u7684\u8bfb\u6cd5<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 if szNum == hzNum[2]..hzUnit[2] then<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 num = string.sub(num, 4, string.len(num))<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 end<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 return num<\/div>\n
\u00a0 \u00a0 end<\/div>\n
\u00a0 \u00a0 return removeZero(szChMoney)..”\u5706”<\/div>\n
end<\/div>\n
<\/div>\n
— \u91d1\u989d\u5c0f\u6570\u70b9 \u89d2\u3001\u5206\u8f6c\u6362 \u4e2d\u6587\u5927\u5199<\/div>\n
function jiaofen_zh(szNum)<\/strong><\/div>\n
\u00a0 \u00a0 local szChMoney = “”<\/div>\n
\u00a0 \u00a0 local iLen = 0<\/div>\n
\u00a0 \u00a0 local iNum = 0<\/div>\n
\u00a0 \u00a0 local iAddZero = 0<\/div>\n
\u00a0 \u00a0 local hzUnit = {“\u5206”, “\u89d2”}<\/div>\n
\u00a0 \u00a0 local hzNum = {“\u96f6”, “\u58f9”, “\u8d30”, “\u53c1”, “\u8086”, “\u4f0d”, “\u9646”, “\u67d2”, “\u634c”, “\u7396”}<\/div>\n
<\/div>\n
\u00a0 \u00a0 if nil == tonumber(szNum) then<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 return ‘\u8bf7\u8f93\u5165\u91d1\u989d’<\/div>\n
\u00a0 \u00a0 end<\/div>\n
<\/div>\n
\u00a0 \u00a0 iLen =string.len(szNum)<\/div>\n
<\/div>\n
\u00a0 \u00a0 if iLen > 15 or iLen == 0 or tonumber(szNum) < 0 then<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 return “\u8bf7\u8f93\u5165\u91d1\u989d”<\/div>\n
\u00a0 \u00a0 end<\/div>\n
\u00a0 \u00a0 local i = 0<\/div>\n
\u00a0 \u00a0 for i = 1, iLen do<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 iNum = string.sub(szNum,i,i)<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 if iNum == 0 then<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 iAddZero = iAddZero + 1<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 else<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 if iAddZero > 0 then<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 szChMoney = szChMoney..hzNum[1]<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 end<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 szChMoney = szChMoney..hzNum[iNum + 1] –\/\/\u8f6c\u6362\u4e3a\u76f8\u5e94\u7684\u6570\u5b57<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 iAddZero = 0<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 end<\/div>\n
<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 if iNum ~=0 or iLen-i==3 or iLen-i==11 or ((iLen-i+1)%8==0 and iAddZero<4) then<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 szChMoney = szChMoney..hzUnit[iLen-i+1]<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 end<\/div>\n
\u00a0 \u00a0 end<\/div>\n
<\/div>\n
\u00a0 \u00a0 return szChMoney<\/div>\n
end<\/div>\n
<\/div>\n
— \u5bf9\u5b57\u7b26\u4e32\u8fdb\u884c \u62c6\u5206 \uff0c\u76ee\u7684\u662f \u5c06 1309.21 \u62c6\u5206\u4e3a 1309 \u53ca 21 \u4e24\u4e2a\u5b57\u7b26\u4e32<\/div>\n
function split(str,delimiter)<\/strong><\/div>\n
\u00a0 \u00a0 local dLen = string.len(delimiter)<\/div>\n
\u00a0 \u00a0 local newDeli = ”<\/div>\n
\u00a0 \u00a0 for i=1,dLen,1 do<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 newDeli = newDeli .. “[“..string.sub(delimiter,i,i)..”]”<\/div>\n
\u00a0 \u00a0 end<\/div>\n
<\/div>\n
\u00a0 \u00a0 local locaStart,locaEnd = string.find(str,newDeli)<\/div>\n
\u00a0 \u00a0 local arr = {}<\/div>\n
\u00a0 \u00a0 local n = 1<\/div>\n
\u00a0 \u00a0 while locaStart ~= nil<\/div>\n
\u00a0 \u00a0 do<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 if locaStart>0 then<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 arr[n] = string.sub(str,1,locaStart-1)<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 n = n + 1<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 end<\/div>\n
<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 str = string.sub(str,locaEnd+1,string.len(str))<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 locaStart,locaEnd = string.find(str,newDeli)<\/div>\n
\u00a0 \u00a0 end<\/div>\n
\u00a0 \u00a0 if str ~= nil then<\/div>\n
\u00a0 \u00a0 \u00a0 \u00a0 arr[n] = str<\/div>\n
\u00a0 \u00a0 end<\/div>\n
\u00a0 \u00a0 return arr<\/div>\n
end<\/div>\n
<\/div>\n
— \u9700\u8981\u5224\u65ad\uff0c\u91d1\u989d\u662f\u5426\u5305\u542b\u5c0f\u6570\u70b9\uff0c\u82e5 \u5305\u542b\u5c0f\u6570\u70b9\uff0c\u9700\u8981\u5c06\u5c0f\u6570\u70b9\u524d \u8bbe\u7f6e\u4e3a\uff1astrYuan \uff1b \u5c0f\u6570\u70b9\u540e \u8bbe\u7f6e\u4e3a\uff1astrJiaoFen<\/div>\n
local strYuan,strJiaoFen,strDaxie,strOldjine<\/div>\n
<\/div>\n
strOldjine = “104567096”\u00a0 — \u5c06\u6765\u8fd9\u4e2a\u6570\u5b57\u8d4b\u503c\u7684\u65f6\u5019\uff0c\u5c0f\u6570\u70b9\u8981\u4fdd\u75592\u4f4d\uff0c\u6700\u597d\u5c0f\u6570\u7b2c\u4e8c\u662f0\u8981\u5904\u7406\u4e00\u4e0b<\/div>\n
<\/div>\n
t = split(strOldjine, “.”)\u00a0 \u00a0 \u00a0— \u5c06 124567.09 \u62c6\u5206\u4e3a 124567 \u53ca 09 \u4e24\u4e2a\u5b57\u7b26\u4e32<\/div>\n
<\/div>\n
— \u7ed9 \u91d1\u989d \u6574\u6570\u5143 \u8d4b\u503c\uff1b \u7ed9 \u91d1\u989d \u89d2\u5206 \u8d4b\u503c<\/div>\n
local strY = t[1]<\/div>\n
local strJ = t[2]<\/div>\n
<\/div>\n
–\u5c0f\u6570\u70b9\u524d\u6574\u6570 \u5143\uff08\u9700\u72ec\u7acb\u83b7\u53d6\uff09<\/div>\n
strYuan = yuan_zh(strY)<\/div>\n
— \u91d1\u989d \u7684\u5c0f\u6570\u70b9\u524d\u7684 \u5927\u5199<\/div>\n
strDaxie = strYuan<\/div>\n
<\/div>\n
–strJ\u5c0f\u6570\u70b9\u540e \u89d2\u5206 \uff08\u9700\u72ec\u7acb\u83b7\u53d6\uff09<\/div>\n
if strJ ~= nil then<\/div>\n
\u00a0 \u00a0 strJiaoFen = jiaofen_zh(strJ)<\/div>\n
\u00a0 \u00a0 — \u5b8c\u6574\u5927\u5199\u91d1\u989d \u62fc\u63a5\u540e\u5b8c\u6210<\/div>\n
\u00a0 \u00a0 strDaxie = strDaxie..strJiaoFen<\/div>\n
end<\/div>\n
<\/div>\n
— for i = 1 ,200 do<\/div>\n
\u00a0 \u00a0print(strDaxie)<\/div>\n
— end<\/div>\n","protected":false},"excerpt":{"rendered":"

\u8d22\u52a1\u4e13\u7528\uff1a\u963f\u62c9\u4f2f\u6570\u5b57\u8f6c\u4e2d\u6587\u5927\u5199\u91d1\u989d\uff08\u652f\u6301\u5c0f\u6570\uff09 — \u91d1\u989d\u5c0f\u5199\u6570\u5b57 \u6574\u6570\u5143 \u8f6c\u6362 \u4e2d\u6587\u5927\u5199 func […]<\/p>\n","protected":false},"author":1,"featured_media":1195,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,6,2,4],"tags":[16,17,15],"class_list":["post-1200","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-news","category-ercikf","category-pcenter","category-shishi","tag-shouce","tag-fangan","tag-sql"],"_links":{"self":[{"href":"http:\/\/www.haoht.com.cn\/wp-json\/wp\/v2\/posts\/1200","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.haoht.com.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.haoht.com.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.haoht.com.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.haoht.com.cn\/wp-json\/wp\/v2\/comments?post=1200"}],"version-history":[{"count":1,"href":"http:\/\/www.haoht.com.cn\/wp-json\/wp\/v2\/posts\/1200\/revisions"}],"predecessor-version":[{"id":1201,"href":"http:\/\/www.haoht.com.cn\/wp-json\/wp\/v2\/posts\/1200\/revisions\/1201"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.haoht.com.cn\/wp-json\/wp\/v2\/media\/1195"}],"wp:attachment":[{"href":"http:\/\/www.haoht.com.cn\/wp-json\/wp\/v2\/media?parent=1200"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.haoht.com.cn\/wp-json\/wp\/v2\/categories?post=1200"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.haoht.com.cn\/wp-json\/wp\/v2\/tags?post=1200"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}