2
0
mirror of https://github.com/koreader/koreader synced 2024-11-16 06:12:56 +00:00
koreader/frontend/util.lua
2015-02-01 17:40:45 +08:00

12 lines
317 B
Lua

local util = {}
function util.stripePunctuations(word)
if not word then return end
-- strip ASCII punctuation characters around word
-- and strip any generic punctuation (U+2000 - U+206F) in the word
return word:gsub("\226[\128-\131][\128-\191]",''):gsub("^%p+",''):gsub("%p+$",'')
end
return util