سؤال

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