Extract parameter
Refactor | Extract/Introduce | Parameter
CtrlAlt0P
The Extract Parameter refactoring is used to add a new parameter to a method declaration and to update the method calls accordingly.
The animation below demonstrates how to add a method parameter by extracting a value from a string:

To extract a parameter:
Select a value to refactor or place the caret at a string containing the required value.
In the main menu, go to Refactor | Extract/Introduce | Parameter CtrlAlt0P.
(Optional) If you place the caret at a place containing several expressions available for extracting, select the required expression and press Enter:
In the invoked dialog, specify the parameter name and type:
You can use various parameter types such as positional, array, keyword and so on.
Click Refactor.
Before | After |
---|---|
|
|
Thanks for your feedback!