lua split实现(lua程序设计10.6练习10.1题)
生活随笔
收集整理的這篇文章主要介紹了
lua split实现(lua程序设计10.6练习10.1题)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
lua split實現(lua程序設計10.6練習10.1題)
local function split(s,sp)local t = {}local last = 1local irepeati = string.find(s,sp,last,true)if i thenif i ~= last thent[#t+1] = string.sub(s,last,i-1)endlast = i+1elseif last <= #s thent[#t+1] = string.sub(s,last,#s)enduntil not ireturn table.concat(t,sp) endlocal t = split("a whole new world"," ") print(t)總結
以上是生活随笔為你收集整理的lua split实现(lua程序设计10.6练习10.1题)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 荨麻疹怎么断根
- 下一篇: 炒面粉的功效与作用、禁忌和食用方法