Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Regular Expression to replace CGRectMake

As CGRectMake is not available in swift 3.0 and migrator did not convert it i need to manually replace it and it is used more than 300 times in my code so can anyone help me in this to develop regular expression so i can find and replace code. What i want to do is to convert

CGRectMake(a,a,a,a) here a is some value.

to

CGRect(x: a, y: a, w: a, h: a)

like image 421
Parth Adroja Avatar asked Dec 02 '25 06:12

Parth Adroja


1 Answers

Find by this:

CGRectMake\(([^,]*),([^,]*),([^,]*),([^,]*)\)

and Replace by this:

CGRect\(x:\1, y:\2, w:\3, h:\4\)

Tried it in notepad++

like image 54
Rizwan M.Tuman Avatar answered Dec 03 '25 19:12

Rizwan M.Tuman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!