Using eclipse find and replace all to swap arguments

后端 未结 5 567
夕颜
夕颜 2021-02-07 20:46

I have about 100 lines that look like the below:

assertEquals(results.get(0).getID(),1);

They all start with assertEquals and contain two arguments. Im looking f

5条回答
  •  悲哀的现实
    2021-02-07 21:04

    use the following regexp to find:

    assertEquals\((.*),(.*)\);
    

    and this replacement value:

    assertEquals(\2,\1);
    

    The regexp means "assertEquals( followed by a first group of chars followed by a comma followed by a second group of chars followed by );".

    The replacement value means "assertEquals( followed by the second group of chars found followed by a comma followed by the first group of chars found followed by );".

提交回复
热议问题