lua-users home
lua-l archive

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


On Jan 14, 2006, at 5:16 PM, PA wrote:

At first glance, the "URLAnd" sequence would appear problematic.

Perhaps something along these lines:

local aString = "componentWithURLAndParameters"

aString = aString:gsub( "(%l)(%u)", "%1 %2" )
aString = aString:gsub( "(%u)(%u)(%l)", "%1 %2%3" )
aString:gsub( "%a+", print )

> component
> With
> URL
> And
> Parameters

Much better, but problematic cases are still fairly easy to construct:

"componentWithAURL"
"registerAPIs"
"getCPUID"

The first one's a bit contrived, I admit, but the symbol table of any moderately sized program probably contains more than a few like these. As someone once said, "The problem with making something idiot-proof is that idiots are so clever."

Cheers,

David