9

Just imagine I have defined a list of static variables in lower case on my editor.

Is there any option in intellij where I can select a portion of my source code and convert it into either upper/lower case?

Supun Wijerathne
  • 11,964
  • 10
  • 61
  • 87

1 Answers1

16

There are two options available.

  1. Use toggle case action

    • Select text

    • Invoke Edit | Toggle Case action or

      Keyboard shortcut: Ctrl + Shift + U for Windows/Linux & Cmd + Shift + U for Mac

  2. Use find and replace text using regular expressions

    • Select text

    • Invoke Edit | Find | Replace… action or

      Keyboard shortcut: Ctrl + R for Windows/Linux & Cmd + R for Mac

    • Choose the "Search In Selection" & "Regex" search options

    • Search for (.+) to select all characters and include them in a single capturing group

    • Use \U$1 as the replacement, which replaces all characters in the capturing group with the uppercase equivalent

    • Click "Replace All" to perform the text replacement

M. Justin
  • 14,487
  • 7
  • 91
  • 130
Andrey
  • 15,144
  • 25
  • 91
  • 187