On Mon, Apr 27, 2009 at 01:25, Paul M Foster <[email protected]> wrote:
> I know it's probably heresy for a lot of coders, but does anyone know a
> function or class or regexp or somesuch which will scan through a PHP
> file and convert all the CamelCase code into proper C-type code? That
> is, "CamelCase" gets converted to "camel_case". I snagged a bunch of
> someone else's PHP code I'd like to modify, but it's coded the wrong
> way, so I'd like to fix it.
The other suggestions are more appropriate, of course, but in
direct response to your question, something like this would work
(though I'm typing it in here and it hasn't been tested):
#!/bin/bash
if(test "`which vim`" == ""); then
vi=`which vi`;
else
vi=`which vim`;
fi;
$vi `grep -lRi \$[a-z0-9] *` '+%s/\$\([a-zA-Z0-9_]\)\+/\L&\E/g' '+wn' '+q'
--
</Daniel P. Brown>
[email protected] || [email protected]
http://www.parasane.net/ || http://www.pilotpig.net/
50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW10000
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php