lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> A "concat" function is planned to be added to the standard string library.
> It would receive a table and perhaps an optional string separator, to be
added
> between the strings in the table.

This sounds pretty sweet, especially the optional seperator string. Reminds
me of the [NSArray componentsJoinedByString] method from the OpenStep
foundation libraries.

Any thoughts on making a function that's the opposite as well? Something
that would take a string and a seperator and return a table whose elements
contained the original string split apart based on the separator. Or can
this be done with gsub without creating a bunch of temp strings? I'm not
very familiar with gsub so I'm not sure.

My experience with OpenStep has shown me that a couple of simple functions
like this can make a lot of text parsing tasks laughably simple. Having them
written in C to minimize the amount of temporary strings created would be a
nice bonus.