mirror of https://github.com/koreader/koreader
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12 lines
317 B
Lua
12 lines
317 B
Lua
9 years ago
|
|
||
|
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
|