편집 요약 없음
편집 요약 없음
12번째 줄: 12번째 줄:
end
end
end
end
function p.tounicode_( char, base )
function p.tounicode_( char, base, offset )
if type(char) == 'string' then
if type(char) == 'string' then
if offset == nil then offset = 0 end
local baseformat
local baseformat
if base == '10' then baseformat = '%d'
if base == '10' then
else baseformat = '%x' end
baseformat = '%d'
return 'U+'..ustring.upper(ustring.format(baseformat, ustring.codepoint(char)))
else
baseformat = '%x' end
return 'U+'..ustring.upper(ustring.format(baseformat, ustring.codepoint(char) + offset))
else
else
return 0
return 0
26번째 줄: 29번째 줄:
local char = getArgs(frame)[1] or nil
local char = getArgs(frame)[1] or nil
if char then
if char then
return p.tounicode_(char)
return p.tounicode_(char, 16, 1)
else
else
return '입력값이 없습니다.'
return '입력값이 없습니다.'
32번째 줄: 35번째 줄:
end
end
----------------------  prev codepoint  ---------------------------------------
----------------------  prev codepoint  ---------------------------------------
function p.prevunicode( frame )
local char = getArgs(frame)[1] or nil
if char then
return p.tounicode_(char, 16, -1)
else
return '입력값이 없습니다.'
end
end
-- string.char
-- string.char
function p.char( frame )
function p.char( frame )