문제

How can I add commas to separate text inside a string

Let's assume I have this string:

local s = "some text here"

I want to convert that string (without white space) to:

local t = "some,text,here"

Any help will be appreciated..

도움이 되었습니까?

해결책

You can use the gsub()

t = string.gsub(s, " ", ",")
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top