lua-users home
lua-l archive

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


Hello,

Does anyone have a simple pattern to split camel case strings?

For example:

"componentWithName" -> { "component", "With", "Name" }

Here is what I have presently:

( "componentWithName" ):gsub( "%u?%l+", print )

> component
> With
> Name

However this doesn't quite cover all potential cases, specially acronyms (e.g. "componentWithURL"):

http://www.cincomsmalltalk.com/userblogs/vbykov/blogView? showComments=true&entry=3271976088

Also, is the "frontier pattern" aka "%f" something which is officially supported? It doesn't seem to be documented anywhere beside this wiki page:

http://lua-users.org/wiki/FrontierPattern

Ideas?

Cheers

--
PA, Onnay Equitursay
http://alt.textdrive.com/