模組:沙盒/Fauzty/Bushou

文档图示 模块文档[创建]
local b = {}

function b.kangxiradical ( foo )
    local s = tostring(foo)
    cp = mw.ustring.codepoint(s)
    if cp < 0x4E00 then
        return '⓪劃'
    elseif cp >= 0x4E00 and cp < 0x4E8C then
        return '①劃'
    elseif cp >= 0x4EBC and cp < 0x53E3 then
        return '②劃'
    elseif cp >= 0x53E3 and cp < 0x5FC3 then
        return '③劃'
    elseif cp >= 0x5FC3 and cp < 0x7384 then
        return '④劃'
    elseif cp >= 0x7384 and cp < 0x7AF9 then
        return '⑤劃'
    elseif cp >= 0x7AF9 and cp < 0x898B then
        return '⑥劃'
    elseif cp >= 0x898B and cp < 0x9101 then
        return '⑦劃'
    elseif cp >= 0x91D1 and cp < 0x9762 then
        return '⑧劃'
    elseif cp >= 0x9762 and cp < 0x99AC then
        return '⑨劃'
    elseif cp >= 0x99AC and cp < 0x9B5A then
        return '⑩劃'
    else 
        return '⑳劃'
    end
end

function b.codepoint ( foo )
    local s = tostring(foo)
    cp = mw.ustring.codepoint(s)
    return cp
end

return b