4

When I need to interpolate a String variable into a quoted string literal in the Eclipse java editor, I generally type "++" and eclipse usually inserts another " after the latter one, so I then have to go past it with arrow keys and then backspace to remove the duplicate, then go insert some spaces in between the "++" and type my variable name.

This seems like a lot of work. I have found Practically Macro, but I thought there might be something built in for this situation which is very common for me.

2 Answers2

1

I'm not sure if this shortcut exists, try doing CTRL+SHIFT+L when the string is selected.

Also there is this link which has a whole bunch of nice keyboard shortcuts, I know it may not answer the question completely but maybe it'll get you one step closer. :)

**** Edit: In that link the "Ctrl-2 something" post looks promising.****

Community
  • 1
  • 1
Fred
  • 1,486
  • 1
  • 9
  • 6
0

The most relevant built-in feature is maybe the "Pick out part of a string" quick assist:

  • insert a space (or anything else) where you want to add a variable,
  • select it,
  • press Ctrl+1,
  • select the "Pick out part of a string" quick assist,
  • insert your variable name.

Reference: "Pick out part of a string" section in this post.

Community
  • 1
  • 1
Morgan Courbet
  • 772
  • 1
  • 8
  • 18