Re: splitting camel case?
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: splitting camel case?
- From: David Gish <david@...>
- Date: 2006年1月14日 20:09:38 -0600
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