The Extract Constant refactoring creates a constant that holds the selected expression as the value and replaces its occurrences with the references to this newly created constant.
To invoke this refactoring, select an expression to be replaced with a constant and press &shortcut:IntroduceConstant; (Refactor | Extract Constant).

If more than one occurrence of the expression is found, specify whether you wish to replace only the selected occurrence or all the found occurrences with the new variable. Specify the constant name and press &shortcut:EditorEnter;. This will result in the following:
