---
title: "lua字符串截取split"
author: "gukeming888"
date: "2013-08-07T16:46:24Z"
tags: []
categories: ["编程语言"]
slug: "lua-split"
draft: false
lastmod: "2013-08-07T16:46:24Z"
id: 1921617
url: "https://gukeming888.iteye.com/blog/1921617"
---

function string:split(sep)
	local sep, fields = sep or "\t",{}
	local pattern = string.format("(+)", sep)
	self:gsub(pattern, function(c) fields = c end)
	return fields
end