lua gsub

function obj:subWord(word)
    -- 최대 비교 길이를 넘어가는 경우, substring 처리 
    -- https://stackoverflow.com/questions/15979519/detect-if-last-character-is-not-multibyte-in-lua
    local wordLen = string.len(word)
    if wordLen > obj.maxLength then
        word = string.gsub(word, "^[^\128-\191][\128-\191]*", "")
    end
 
    return word
end


관련 문서