Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

10
LINES

< > BotCompany Repo | #137 // Split string (free separator)

Lua code

-- choices for sep are a bit limited, this can probably
-- be done better - but for ":" it works (clock parsing),
-- so no need to invest further here.
function split(s, sep)
  local result = {}
  for token in string.gmatch(s, "[^"..sep.."]+") do
    table.insert(result, token)
  end
  return result
end

test run  test run with input  download  show line numbers   

Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Image recognition results

Recognizer Recognition Result Visualize Recalc
#308 313 [visualize]

Snippet ID: #137
Snippet name: Split string (free separator)
Eternal ID of this version: #137/1
Text MD5: e81c52d244b1cb8d9f50f575a4fdcfa2
Author: stefan
Category:
Type: Lua code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2014-01-11 06:39:57
Source code size: 313 bytes / 10 lines
Pitched / IR pitched: Yes / Yes
Views / Downloads: 937 / 3564
Referenced in: [show references]