Log In  

Cart #knutil_msplit-1 | 2023-05-22 | Code ▽ | Embed ▽ | No License
2

Feature Overview

MSPLIT() Converts a string into a table by splitting it with multiple delimiters.

  • The default delimiter is " " for ease of data entry and readability(according to one's own preference).
  • the default delimiters and numeric conversion flags should be modified according to your project.
  • This function consumes 36 Token.
-- Split a pair of data and further split it into colors and names.

local value=msplit(
     '10-yellow 11-green 8-red 12-blue'
     ,' ','-'
    )

for i,v in pairs(value) do

    local col,name=unpack(v)
    ?name,i*32-24,48,col

end

If you want to check the type at once, consider using a DMP().
This function is included in the KNUTIL library.

release note


v0.1

  • first release
P#130014 2023-05-22 08:40 ( Edited 2023-05-22 08:41)


[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2023-09-22 18:17:23 | 0.010s | Q:13