tags:

views:

35

answers:

1

Dear all,

I would like to ask is there any software or script able to do conversion from Colon syntax to curly brackets syntax? From

if ($value):

endif;

To

if ($value) {

}

I am using Netbeans IDE, when I use curly brackets it will highlight the start or the end point. and I personally also prefer curly brackets syntax.

Anyone know where I can get the solution?

A: 

Press Ctrl+H

Search ): and replace with ) {

Search endif; and replace with }

Also go to Source->Format, you are done!

Otar
not really, some of the code that I have is something like") :" ")<space><space>:", by using this way is more like manual way, I would prefer have an regular express ignore the space, and replace it. However, thanks for your solution :)
Shiro
In that case you can use regex in search option. Check out this article: http://mrhaki.blogspot.com/2008/12/use-regular-expressions-for-search-and.html
Otar
Hi Otar, thanks for your reply, do you have the regex ? That would be helpful with that :)
Shiro
I'm not a regex guru but it should be something like this: `^)/(.*)/:` or `^).*:`
Otar