-- 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
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: | 1007 / 3588 |
Referenced in: | [show references] |