First commit
This commit is contained in:
9
exercises/ch04/ex4_6.lua
Normal file
9
exercises/ch04/ex4_6.lua
Normal file
@@ -0,0 +1,9 @@
|
||||
local function remove(str, start, length)
|
||||
local slice_start = utf8.offset(str, start - 1)
|
||||
local slice_end = utf8.offset(str, start + length)
|
||||
local start_part = str:sub(1, slice_start)
|
||||
local end_part = str:sub(slice_end)
|
||||
return start_part .. end_part
|
||||
end
|
||||
|
||||
print(remove("ação", 2, 2))
|
||||
Reference in New Issue
Block a user