码迷,mamicode.com
首页 > 其他好文 > 详细

【lua】lua string.match 和 string.split 从字符串中寻找特定字符串并保存

时间:2017-05-31 16:41:14      阅读:380      评论:0      收藏:0      [点我收藏+]

标签:split   [1]   oca   ras   特定   match   lua   mat   local   

local string = "{1,2,3,4}"

 

local traString=string.match(string , "%d+,%d+,%d+,%d+")

--此时tranString = "1,2,3,4",去掉"{","}"


string = string.split(tranString , ",")

string = {1,2,3,4}

string[1]=1

string[2]=2

string[3]=3

string[4]=4

【lua】lua string.match 和 string.split 从字符串中寻找特定字符串并保存

标签:split   [1]   oca   ras   特定   match   lua   mat   local   

原文地址:http://www.cnblogs.com/Faiz-room/p/6924548.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!