The Extract Constant refactoring helps eliminate hardcoded constants from your code, making it easier to read and maintain. In the editor, select an expression or declaration of a variable you want to replace with a constant and press &shortcut:IntroduceConstant; (Refactor | Extract | Constant).

For example, in the code fragment below, you could select a constant in the code

Extrat constant

and press &shortcut:IntroduceConstant; (Refactor | Extract Constant).

This will result in the following:

Extracted constant