PHPでcamelize
前にPerl版書いたけど
hoge_mugeをHogeMugeにする - Unknown::Programming
それのPHP版です。
<?php function camelize ($str) { return str_replace(' ','',ucwords(str_replace('_',' ',$str))); } function decamelize ($str) { return ltrim(preg_replace('/([A-Z])/e',"'_'.strtolower('$1')",$str),'_'); }
ってかこーゆー処理のことをcamelizeっていうんだね、最近まで知らなかった。