I need to do a simple split of a string, but there doesn't seem to be a function for this, and the manual way I tested didn't seem to work. How would I do it?
Split string in Lua
luastring
Related Topic
- Python – Convert bytes to a string
- Bash – Extract filename and extension in Bash
- Javascript – How to make the first letter of a string uppercase in JavaScript
- Javascript – How to replace all occurrences of a string in JavaScript
- Javascript – How to check whether a string contains a substring in JavaScript
- Java – How to split a string in Java
- How to break a string in YAML over multiple lines
- Pythonic way to create a long multi-line string
Best Answer
Here is my really simple solution. Use the gmatch function to capture strings which contain at least one character of anything other than the desired separator. The separator is **any* whitespace (%s in Lua) by default:
.