open:lua-gsub

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
  • 마지막으로 수정됨: 2022/11/18 07:47
  • 저자 127.0.0.1