Browse Source

Added functions to trim colors and translate tags from a string.

pull/45/head
atom0s 8 years ago
parent
commit
d82dec0d22
  1. 16
      addons/libs/stringex.lua

16
addons/libs/stringex.lua

@ -342,3 +342,19 @@ function string:parseargs() @@ -342,3 +342,19 @@ function string:parseargs()
-- Return the found arguments..
return args;
end
----------------------------------------------------------------------------------------------------
-- func: string.strip_colors
-- desc: Strips FFXi based colors from a string.
----------------------------------------------------------------------------------------------------
function string.strip_colors(s)
return (s:gsub('[' .. string.char(0x1E, 0x1F, 0x7F) .. '].', ''));
end
----------------------------------------------------------------------------------------------------
-- func: string.strip_translate
-- desc: Strips FFXi based auto-translate tags from a string.
----------------------------------------------------------------------------------------------------
function string.strip_translate(s)
return (s:gsub(string.char(0xEF) .. '[' .. string.char(0x27, 0x28) .. ']', ''));
end
Loading…
Cancel
Save