intellij-ideauppercaselowercase

Text uppercase option in intellij?


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?


Solution

  • There are two options available.

    1. Use toggle case action

      • Select text

      • Invoke Edit | Toggle Case action or

        Keyboard shortcut:
        Windows & Linux: Ctrl + Shift + U
        Mac: + Shift + U

    2. Use find and replace text using regular expressions

      • Select text

      • Invoke Edit | Find | Replace… action or

        Keyboard shortcut:
        Windows & Linux: Ctrl + R
        Mac: + R

      • 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