Split String at Index?

What do you mean by “after the index”? Do you want splitting "ThisIsAString" with the index being 5 to split it to "This" and IsAString rather than ThisI and sAString? In that case, just change the is in the function to something like this:

local function split(s, i)
    return string.sub(s, 1, i - 1), string.sub(s, i, #s)
    --subtracted 1 from each side
end
1 Like