iPanda Posted January 16, 2015 Share Posted January 16, 2015 Is there a function in Lua, allowing division 1 string to several parts strings? Example: 'example_string124' --division to strings: 'example' and '_string' and '124' In the worst case, is it possible? And how do I do this? Link to comment
novo Posted January 16, 2015 Share Posted January 16, 2015 You've got several options: (two given down below) local example = "example_string124" local parts = split(example, "_") -- This splits the above string into: example and string124 and creates a table that contains both new strings for i,v in ipairs(parts) do print(v) end -- local cut = example:sub(1, 5) -- This cuts the string until the 5th letter print(cut) -- examp Link to comment
iPanda Posted January 16, 2015 Author Share Posted January 16, 2015 It is helped me: string.sub, thank Link to comment
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