Karoffe Posted July 6, 2015 Posted July 6, 2015 I know how to use the split function, but I really need to understand how can it be done manually, so lets imagine that this function doesn't even exist how can I create my own one which can work like split function ? Well, I am not asking for the code, am asking for the "way" of doing it.
Bonsai Posted July 6, 2015 Posted July 6, 2015 You go through the String until u find the char that splits, and cut from beginning to that position I guess. Save that, and continue until end of String.
joaosilva099 Posted July 6, 2015 Posted July 6, 2015 This can help you understanding: function string.explode(self, separator) Check("string.explode", "string", self, "ensemble", "string", separator, "separator") if (#self == 0) then return {} end if (#separator == 0) then return { self } end return loadstring("return {\""..self:gsub(separator, "\",\"").."\"}")() end
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now