跳转到内容

模組:US elections imagemap/utils

维基百科,自由的百科全书

这是Module:US elections imagemap/utils当前版本,由Short Final留言 | 贡献编辑于2022年11月14日 (一) 18:55 建立内容为“local p = {} function p.stripspaces(str) return str:gsub("^%s*(.-)%s*$", "%1") -- trim spaces end function p.split(str, sep) -- split string by separator and return table sep = sep or "%s" local parts = {} for word in string.gmatch(str, "[^" .. sep .. "]+") do parts[#parts+1] = p.stripspaces(word) end return parts end return p”的新页面)。这个网址是本页该版本的固定链接。

(差异) ←上一修订 | 最后版本 (差异) | 下一修订→ (差异)
local p = {}

function p.stripspaces(str)
	return str:gsub("^%s*(.-)%s*$", "%1") -- trim spaces
end

function p.split(str, sep) -- split string by separator and return table
  sep = sep or "%s"
  local parts = {}
  for word in string.gmatch(str, "[^" .. sep .. "]+") do parts[#parts+1] = p.stripspaces(word) end
  return parts
end

return p