http://bmky.net/text/note/javascript-css.html
と、やれば良いらしい。もっと複雑な例として、
str = str.replace( /[A-Z]/g, function( $0 ) { return "-" + $0.toLowerCase( ) } );
というのもある。
this.replace( /-([a-z])/g, function( $0, $1 ) { return $1.toUpperCase( ) } );
http://bmky.net/text/note/javascript-css.html
と、やれば良いらしい。もっと複雑な例として、
str = str.replace( /[A-Z]/g, function( $0 ) { return "-" + $0.toLowerCase( ) } );
というのもある。
this.replace( /-([a-z])/g, function( $0, $1 ) { return $1.toUpperCase( ) } );