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 :: roblox lua wait for player to load 
Lua :: roblox how to detect human touchinhg 
Lua :: fivem commands lua example 
Lua :: lua script 
Lua :: lua function 
Lua :: lua wait function 
Lua :: What is The Color changing script for luaa 
Lua :: lua how to make a click to activate button 
Lua :: lua split 
Lua :: how to make a day/night script roblox 
Lua :: lua loop through string 
Lua :: lua prin type of variable 
Lua :: when do true loop on roblox 
Lua :: lua print hi 
Matlab :: save mat file script in matlab directory 
Matlab :: repeat characters matlab 
Matlab :: matlab make last value the first one etc 
Matlab :: BIDS json IntendedFor field examples 
Basic :: visual basic get mouse position 
Basic :: Loop inner fiter() 
Elixir :: hello world in elixir 
Elixir :: split list in elixir 
Scala :: scala empty list 
Scala :: scala default parameter skip one 
Excel :: Google Sheets How to Count the Days Between Two Dates 
Excel :: google sheets apply formula to entire column 
Perl :: perl http request 
Pascal :: does not equal in pascal 
Gdscript :: godot check left mouse button 
Cobol :: google apps script remove nulls array 
ADD CONTENT
Topic
Content
Source link
Name
4+2 =