7

I have some code with a whole bunch of variable names like

MY_VARIABLE_ONE
MY_VARIABLE_TWO

But these aren't final , they're regular variables. So I want to reformat them to proper java camel-case, e.g.

myVariableOne
myVariableTwo

Is there a way that Eclipse can do this for me? (Failing that, some other tool?)

This question was marked as a possible duplicate of "Change case in eclipse". That question just deals with uppercase to lowercase. Camel-case is not addressed (just about any editor can do uppercase to lowercase, that's a trivial problem to solve)

Steve
  • 4,457
  • 12
  • 48
  • 89
  • @Antoniossss not a duplicate. The other question involves upper to lower or lower to upper. It doesn't address camelcase, which is a more difficult problem – Steve Apr 29 '19 at 20:32
  • No, one of the answers includes camelcase conversion - duplicate. – Antoniossss Apr 29 '19 at 20:36
  • 3
    https://marketplace.eclipse.org/content/anyedit-tools This seems to be what you're looking for. It's a plugin. I found this from @FranckDernoncourt answer on [Changing the case of a string in Eclipse](https://stackoverflow.com/questions/6793570/changing-the-case-of-a-string-in-eclipse) – Elroy Jetson Apr 29 '19 at 20:30
  • 2
    The function is called [_Convert > Camel <-> Underscores_](http://andrei.gmxhome.de/anyedit/index.html) and is available e.g. in the right-click menu or via shortcut (Ctrl+Alt+K). – howlger Apr 29 '19 at 20:39
  • @ElroyJetson I appreciated your answer. The answer on the other question is buried several answers down and is incidentally included in a screenshot...I imagine many people (myself included) missed it on the other one. – Steve Apr 29 '19 at 20:42
  • You can use the free eclipse plugin [AnyEdit Tools](http://marketplace.eclipse.org/content/anyedit-tools), which will add some entries to the context menu to change the case of the selected text. It contains multiple options for formatting. – Irshad Jun 15 '21 at 04:41

0 Answers0