PageRenderTime 36ms CodeModel.GetById 30ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/pingji_adv_star.lua

https://code.google.com/p/google-pinyin-api/
Lua | 44 lines | 29 code | 4 blank | 11 comment | 6 complexity | 789a40c2e6244ff3fd30a483fbbded00 MD5 | raw file
 1-- encoding: UTF-8
 2
 3------------------------------------------------
 4-- ??????? ?? ???
 5-- ??: 0.1.0.1
 6-- ???Yichen Lu
 7-- ?????http://yichenlu.cn/
 8-- ????: http://code.google.com/p/google-pinyin-api/
 9--
10-- ?????GPLv3??
11--
12------------------------------------------------
13
14_YichenLu_Pingji_EMPTY = '?'
15_YichenLu_Pingji_FULL = '?'
16
17function YichenLu_Pingji_Adv(input)
18  if #input > 0 then
19    a=string.find(input, "/")
20    if a==nil then
21      b=tonumber(input)
22      c=5
23    else
24      b=tonumber(string.sub(input,1, a-1))
25      c=tonumber(string.sub(input,a+1))
26    end
27    if b>c then
28      b=c
29    end
30    if b<0 then
31      b=0
32    end
33    out=''
34    for i=1,b do
35      out = out .. _YichenLu_Pingji_FULL
36    end
37    for i=1,c-b do
38      out = out .. _YichenLu_Pingji_EMPTY
39    end
40    return out
41  end
42end
43
44ime.register_command("pj", "YichenLu_Pingji_Adv", "??", "none", "?? ??/?????????? 5?5/10 ? ??????????")