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

  • open/lua-gsub.txt
  • Last modified: 2024/10/05 06:15
  • by 127.0.0.1