add gs
This commit is contained in:
+16
@@ -0,0 +1,16 @@
|
||||
return function(targetString, blacklistedCharacter)
|
||||
local charactersArray = {}
|
||||
local indexArray = {}
|
||||
for index, byte in utf8.codes(targetString) do
|
||||
local graphemeCharacter = utf8.char(byte)
|
||||
table.insert(charactersArray, 1, graphemeCharacter)
|
||||
table.insert(indexArray, 1, index)
|
||||
end
|
||||
for index, graphemeCharacter in ipairs(charactersArray) do
|
||||
if graphemeCharacter ~= blacklistedCharacter then
|
||||
return targetString:sub(1, indexArray[index])
|
||||
end
|
||||
end
|
||||
|
||||
return ""
|
||||
end
|
||||
Reference in New Issue
Block a user