Re: table.split?
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: table.split?
- From: Richard Warburton <richard@...>
- Date: 2007年1月12日 22:44:36 +1300
On 1/11/07, Richard Warburton <richard@warburton.it> wrote:
> Since we have table.concat, any chance of adding a complementing
> function (perhaps table.split) to the standard libraries?
>
> [..snip..]
Arguably, the most versatile and elegant implementation of split
function (generator) I ever saw is due to Rici Lake:
http://lua-users.org/lists/lua-l/2006-12/msg00414.html
Perhaps, but what I was suggesting is the exact inverse of table.concat
(without pattern matching - unless table.concat somehow does pattern
matching?).
I.E.
start = {'H','E','L','L','O'}
middle = table.concat(start,'[*]') -> "H[*]E[*]L[*]L[*]O"
end = table.split(middle,'[*]') - > {'H','E','L','L','O'}