在字符串中添加逗号

时间:2013-07-21 10:21:09

标签: string lua split comma

如何添加逗号以分隔字符串

中的文本

我们假设我有这个字符串:

local s = "some text here"

我想将该字符串(不带空格)转换为:

local t = "some,text,here"

任何帮助将不胜感激..

1 个答案:

答案 0 :(得分:4)

您可以使用gsub()

t = string.gsub(s, " ", ",")
相关问题