29

Is there a way to convert a block of text to title case in Notepad++?

It should turn

asdf ASDF aSdF

into

Asdf Asdf Asdf

I see upper case and lower case on the edit menu, but those aren't quite what I'm looking for.

40

The TextFX plugin has this feature, they call it "Proper Case". You can find it under TextFX -> TextFX Characters -> Proper Case:

alt text

| improve this answer | |
  • 1
    Does this have a Hotkey? – Homer Mar 26 '14 at 18:33
  • 3
    @Homer - you can assign one in Plugin Commands section of Shortcut Mapper. Item Proper case is present there, waiting for you :) – miroxlav Apr 20 '14 at 0:00
  • 3
    You no longer need the TextFX plugin to convert between casing styles. Notepad++ has it "natively". It's under Edit | Convert case to – Marjan Venema Jul 9 '17 at 11:21
  • 1
    Alt-U is the shortcut. – Michael S. Dec 22 '17 at 8:13
  • The last comment should be in accepted answer. – Aman Feb 4 '19 at 11:14
11

You can use replace text by regular expression:

enter image description here

Explanation:

Search text

  • \< matches the beginning of a word
  • (\w+) matches any sucession of word letters

Substituted by

  • \L translates everything to lowercase until the end of the replacement string
  • \u translates the next letter to uppercase
  • \1 places the first captured () search group

    1:

| improve this answer | |
8

As the way has changed in the meantime here is how it works now (without TextFX):

Select the case you want to convert, press Alt-U or choose

Edit - Convert Case to - Title Case.

Convert Case to - Title Case

Converting to Title Case

| improve this answer | |
  • I do not have this menu at NPP 7.5.4 (32-bit). How does one get this? Thank you. – Andrey Kazak Jan 22 '18 at 3:42
  • In the 64-bit version of 7.5.4 it is available. Maybe you want to use this version. – Michael S. Jan 22 '18 at 9:27
  • Thank you. Can you suggest a plugin to get a proper Title Case (first word capitalized, and all other words, except for articles, prepositions and conjunctions)? – Andrey Kazak Jan 24 '18 at 3:14
  • I do not think this exists. You could paste your text into a translation program like Google Translate or DeepL and translate back and forth. Maybe this helps a bit. But you will have to verify it manually afterwards. – Michael S. Jan 24 '18 at 9:48
2

If you can't install the TextFX plug in you can create a macro that does something very close:

Place your cursor near a word, and click the red dot on the tool bar, or Macro>Start Recording.

  1. Use the ctrl+shift+ (left arrow key), to select the whole word

  2. Make it lowercase (ctrl+u).

  3. Press to go to the front of the word.

  4. Highlight the first letter (using shift+ once)

  5. Uppercase that, (ctrl+shift+u).

Press the black square, or go to Macro>Stop Recording. In the same section on the tool bar you should see a button with a floppy disk on it (alternatively there is an option in the macro menu). Press that and assign a hot key, I use ctrl+shift+alt+u.

| improve this answer | |
1

One thing to keep in mind with this. The TextFX plug-in is only in the ANSI version. You will need to download the ZIP file and copy the contents of the ANSI directory to your computer. For some reason, the .exe only installs the unicode without a few key plug-ings.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.