lua string split

function Split(s, delimiter)
    result = {};
    for match in (s..delimiter):gmatch("(.-)"..delimiter) do
        table.insert(result, match);
    end
    return result;
end

split_string = Split("Hello World!", " ")
-- split_string[1] = "Hello"
-- split_string[2] = "World!"

4.5
2

                                    function stringsplit(inputstr, sep)
	if sep == nil then
		sep = "%s"
	end
	local t={}
	i=1
	for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
		t[i] = str i = i + 1
	end
	return t
end

4.5 (2 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
lua SplitStr split into array lua how to split string in lua split words lua how to string split lua lua string split with = lua split string line by line lua separate string by char how to split require function in lua split based on filed lua lua split string into separate letters lua sting split string split in Lua lua 5.1 split lua split string by length string.split function lua split sing lua lua how to split string by char how to split a string into each character lua lua separate string split text in lua split string at character lua split string into delimiter lua split a string lua how to make a split functiuon in lua how to split a string lua lua split function lua split line split lua split a string into a array lua split at character lua lua split library lua string:split lua table split string lua string spliut print 0th element after split in lua how to splits a string into a table lua lua string to arary lua splitting a string up lua join lua join and slice lua join and slize join in lua lua split string by : split by string lua lua split dosen work delimeters lua lua split string into array lua split text lua slit string how to splut a string lua lua string splict how to divide a list by 2 in lua how to divide a list in lua lua split string in list lua split string on character lua split table lua split line based on separator lua separate string by comma lua explode all characters lua explode string lua string explode character lua string explode lua split string by char split text lua lua join strings on comma lua split turn a lua string nwith delimeter into table lua split a string lua split string on comma lua text splite split a string in lua and create a sub-table in lua split a string in lua and create a table in lua split in lua splitting strings lua split function in lua spliting a struing in lua how to separate a string to string array in lua how to separate a string to char array in lua split function lua split string in lua string.split lua function parse string lua lua split string to array how to split a string in lua how to break string into array lua lua join table into string lua split string table lua turn table into string split by spaces splitting string lua how to split a string into an array lua lua split string into table separate string by character lua split string by character lua string split lua string split table lua how to use string.split in lua lua split string in array separate string by | lua string split function lua split string in two parts lua split string function lua lua split string every b characters string.split lua lua split string by space lua how split string by another string lua how parse split string lua string split to table lua string split split string lua lua split string by character lua split string lua split asdfasdfasdf string by delimiter sdfasdfa lua split string by delimiter lua string.split
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source