1 | -- choices for sep are a bit limited, this can probably |
2 | -- be done better - but for ":" it works (clock parsing), |
3 | -- so no need to invest further here. |
4 | function split(s, sep) |
5 | local result = {}
|
6 | for token in string.gmatch(s, "[^"..sep.."]+") do |
7 | table.insert(result, token) |
8 | end |
9 | return result |
10 | 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: | 1458 / 3718 |
| Referenced in: | [show references] |