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: 941 / 3565
Referenced in: #134 - clockplus
#138 - String split function (test)
#338 - Horizontal Segments Visualizer
#340 - Split + Signatures
#341 - Liberation Sans Recognizer
#342 - Liberation Sans Recognizer
#344 - Liberation Sans Recognizer with fixes
#351 - Liberation Sans Recognizer with space detection
#352 - Liberation Sans Recognizer (compressed code)
#353 - Phone number recognizer (digits plus slash)
#358 - Aibo finder v4
#361 - Aibo finder v5
#383 - Battery Symbol Finder
#391 - Battery Level Extractor
#393 - Battery Charging?
#394 - Battery Symbol Finder (optimized)
#395 - Battery Charging? (unoptimized)
#413 - Symbol Finder (include)
#419 - String rep renderer test
#436 - LXTerminal Input Corrector 1
#441 - LXTerminal Input Corrector 1 (repeatable)
#512 - Line annotations expander
#520 - Backport keywords from new case to known case
#3000382 - Answer for ferdie (>> t = 1, f = 0)