打开/关闭菜单
切换首选项菜单
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。

模块:StringUtil

来自此界与彼端
AkiraZea留言 | 贡献2025年3月31日 (一) 15:29的版本 (创建页面,内容为“local p = {} function p.replace(str, target, result) local res = str:gsub(target, result) return res end function p.split(str, separator) local fields = {} local temp = str:gsub(", ", ",") temp:gsub("[^"..separator.."]+", function(c) fields[#fields + 1] = c end) return fields end return p”)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)

此模块的文档可以在模块:StringUtil/doc创建

local p = {}

function p.replace(str, target, result)
	local res = str:gsub(target, result)
	return res
end

function p.split(str, separator)
    local fields = {}
    local temp = str:gsub(", ", ",")
    temp:gsub("[^"..separator.."]+", function(c) fields[#fields + 1] = c end)
    return fields
end

return p