Search
 
SCRIPT & CODE EXAMPLE
 

LUA

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!"
Comment

lua string split

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
Comment

lua split

-- Compatibility: Lua-5.1
function split(str, pat)
   local t = {}  -- NOTE: use {n = 0} in Lua-5.0
   local fpat = "(.-)" .. pat
   local last_end = 1
   local s, e, cap = str:find(fpat, 1)
   while s do
      if s ~= 1 or cap ~= "" then
         table.insert(t, cap)
      end
      last_end = e+1
      s, e, cap = str:find(fpat, last_end)
   end
   if last_end <= #str then
      cap = str:sub(last_end)
      table.insert(t, cap)
   end
   return t
end
Comment

PREVIOUS NEXT
Code Example
Lua :: wait function lua 
Lua :: luau make rainbow part 
Lua :: roblox how to get random object from a table 
Lua :: lua loop through table 
Lua :: how to comment multiple lines in lua 
Lua :: luau how to make region3 
Lua :: roblox kill brick script 
Lua :: lua destroy 
Lua :: roblox tween 
Lua :: lua drawinrect 
Lua :: roblox table.find 
Lua :: roblox buy gamepass script 
Lua :: wait() in lua 
Lua :: lua json 
Lua :: lua game code 
Lua :: datastore roblox 
Lua :: wait for player character roblox 
Lua :: lua how to delete a part for roblox 
Lua :: gun that shoot automaticly roblox 
Lua :: lua math.random 
Lua :: get player who clicked clickdetecter roblox 
Matlab :: matlab symbolic derivative 
Matlab :: matlab complex numbers 
Matlab :: z-score normalize values in tsv file matlab 
Basic :: basic authentication in REST api Dajngo 
Elixir :: elixir string to datetime 
Elixir :: elixir check is nil 
Scala :: scala string to lower case 
Scala :: repartition in spark scala 
Excel :: google sheets sort column by item frequency 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =