testA = "test.test test.test" local t1 = {} for X in string.gfind (testA, "[^ ]+") do table.insert (t1 ,X) end local first = table.concat(t1, "", 1, 1); --output/first test.test testA = "11.11.11.11 test.test" local t2 = {} for X in string.gfind (testA, "[^ ]+") do table.insert (t2 ,X) end local first = table.concat(t2, "", 1, 1); --output/first 11.11.11.11 testA = "100.100.100.100 test.test" local t3 = {} for X in string.gfind (testA, "[^ ]+") do table.insert (t3 ,X) end local first = table.concat(t3, "", 1, 1); --output/first 100.100.100.100 test.test
有谁知道为什么第三个项目不会与 gfind 分开?,无法弄清楚为什么
它适用于两个字符串而不是第三个。