To convert camelCase to underscores, in TextMate, replace ([a-z])([A-Z]) with $1_\l$2
To convert underscores to camelCase, replace ([a-z]+)_([a-z]+) with $1\u$2
Random Ramblings about Macintosh Programming
To convert camelCase to underscores, in TextMate, replace ([a-z])([A-Z]) with $1_\l$2
To convert underscores to camelCase, replace ([a-z]+)_([a-z]+) with $1\u$2
<a href="http://blog.onesadcookie.com/2007/05/camel-case-to-underscores-and-back.html">OneSadCookie: Camel Case to Underscores and Back</a>[url=http://blog.onesadcookie.com/2007/05/camel-case-to-underscores-and-back.html]OneSadCookie: Camel Case to Underscores and Back[/url]
2 comments:
Here's a tab trigger I wrote for adding event listeners:
addEventListener(${1:MouseEvent}.${2:CLICK}, ${3:on${2/(_)?([A-Z])([A-Z]+)/\u$2\L$3/g}}, ${4:false}, ${5:0}, ${6:true});
It assumes the event name is a constant (UPPER_CASED). The interesting part is here:
${2/(_)?([A-Z])([A-Z]+)/\u$2\L$3/g}}
It takes EVENT_TYPE from $2 and mirrors it as EventType.
where can i implment the camelCase globally?
Post a Comment