Difference between revisions of "Module:Common"

Jump to navigation Jump to search
39 bytes added ,  16:15, 23 December 2021
no edit summary
m (3 revisions imported: Importing from localhost)
Line 12: Line 12:
function com.trim(object)
function com.trim(object)
--Use of while instead of if incase multiple whitespaces are present.
--Use of while instead of if incase multiple whitespaces are present.
while string.sub(object, 1, 1) == ' ' do  
if com.exists(object) then
object = string.sub(object, 2)
while string.sub(object, 1, 1) == ' ' do  
end
object = string.sub(object, 2)
end
while string.sub(object, string.len(object)) == ' ' do
while string.sub(object, string.len(object)) == ' ' do
object = string.sub(object, 1, string.len(object) - 1)
object = string.sub(object, 1, string.len(object) - 1)
end
end
end

Navigation menu