이 모듈에 대한 설명문서는 모듈:한글 처리/설명문서에서 만들 수 있습니다

--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
---
local __TS__StringSplit
do
    local sub = string.sub
    local find = string.find
    function __TS__StringSplit(source, separator, limit)
        if limit == nil then
            limit = 4294967295
        end
        if limit == 0 then
            return {}
        end
        local result = {}
        local resultIndex = 1
        if separator == nil or separator == "" then
            for i = 1, #source do
                result[resultIndex] = sub(source, i, i)
                resultIndex = resultIndex + 1
            end
        else
            local currentPos = 1
            while resultIndex <= limit do
                local startPos, endPos = find(source, separator, currentPos, true)
                if not startPos then
                    break
                end
                result[resultIndex] = sub(source, currentPos, startPos - 1)
                resultIndex = resultIndex + 1
                currentPos = endPos + 1
            end
            if resultIndex <= limit then
                result[resultIndex] = sub(source, currentPos)
            end
        end
        return result
    end
end

p = { split = __TS__StringSplit }

-- @noSelfInFile *
function p.charCodeAt(char)
    local a, b, c = string.byte(char, 1, 3)
    return (a - 224) * 4096 + (b - 128) * 64 + c - 128 - 44032
end
function p.convert(text, choseong, jungseong, jongseong)
    local result = string.gsub(
        text,
        "[^%c%p%s%w][^%c%p%s%w][^%c%p%s%w]",
        function(char)
            local code = charCodeAt(char)
            local cho
            local jung
            local jong
            cho = math.floor(code / 588)
            code = code - cho * 588
            jung = math.floor(code / 28)
            code = code - jung * 28
            jong = code
            return (choseong[cho + 1] .. jungseong[jung + 1]) .. jongseong[jong + 1]
        end
    )
    return result
end

return p