美文网首页
Lua String

Lua String

作者: 曾令伟 | 来源:发表于2016-03-17 17:33 被阅读30次

local str = "we are fire \n we are rain we are"

local result = string.split( str, " " )

print("result = ", result )

for key, value in pairs( result ) do

          if value == "\n" then

                        table.remove( result, key )

           end

end

local len = table.getn( result )

print("len = ", len )

相关文章

网友评论

      本文标题:Lua String

      本文链接:https://www.haomeiwen.com/subject/oeyflttx.html