匿名
未登录
中文(中国大陆)
登录
「荏苒之境」
搜索
查看“︁模块:Utils/String”︁的源代码
来自「荏苒之境」
命名空间
模块
讨论
更多
更多
页面操作
阅读
查看源代码
历史
清除缓存
←
模块:Utils/String
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
local utils = {} utils.escape_regex = function(str) return str:gsub("[%(%)%.%%%+%-%*%?%[%^%$%]]", "%%%1") end utils.replace = function(str, this, that, count) return string.gsub(str, utils.escape_regex(this), that:gsub("%%", "%%%%"), count) end utils.trim = function(str) local res = string.gsub(str, "^%s*(.-)%s*$", "%1") return res end utils.split = function(str, sep) if sep == nil then sep = "%s" end local t = {} for str in string.gmatch(str, "([^"..sep.."]+)") do t[#t+1] = str end return t end utils.unword = function(str) local t = {} for str in string.gmatch(str, "([^%s]+)") do t[#t+1] = str end return t end utils.unlines = function(str) local t = {} for line, newline in string.gmatch(str, "([^\n]*)(\n?)") do if line == "" and newline == "" then break elseif string.sub(line, #line) == "\r" then line = string.sub(line, 1, #line - 1) end t[#t+1] = line end return t end utils.match_xml_noattr = function(str, tag) local res = string.match(str, "<"..tag..">(.-)</"..tag..">") return res end utils.sub_xml_noattr = function(str, tag, rep) local res = string.gsub(str, "<"..tag..">(.-)</"..tag..">", rep) return res end utils.expand_xml_noattr = function(str, tag) return utils.sub_xml_noattr(str, tag, "%1") end return utils
该页面使用的模板:
模块:Utils/String/doc
(
查看源代码
)
返回
模块:Utils/String
。
导航
导航
首页
最近更改
随机页面
特殊页面
wiki工具
wiki工具
Cargo数据
页面工具
页面工具
用户页面工具
更多
链入页面
相关更改
页面信息
页面日志