Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local string2Chunk = "sldkfjslkfjsdflksjlksdfjsdklfjsdflksjdflksdjsdkfljskldf"
- -- could be from input
- local function chunkString2Table(sString, iChunkLen)
- local retTable = {}
- local firstChunk
- while string.len(sString)>=iChunkLen do
- firstChunk = string.sub(sString, 1, iChunkLen)
- table.insert(retTable, firstChunk)
- sString = string.sub(sString, iChunkLen)
- end
- if string.len(sString)>=1 then
- table.insert(retTable, sString)
- end
- return retTable
- end
- local chunkTable = chunkString2Table(string2Chunk, 10)
- print (table.concat(chunkTable))
Add Comment
Please, Sign In to add comment