Mathias Åhsberg
Mathias Åhsberg

Reputation: 387

Change how eclipse formatter wraps long strings

I have set the eclipse java formatter to wrap lines that exceed 120 characters to conform to our team's coding standard. However, when I have a long string that is wrapped I want the plus sign (+) to appear as the last character on the first line e.g.

String s = "Very long line that should be " +
"wrapped across several rows"; 

The default behaviour is that the plus sign is placed on its own line e.g.

String s = "Very long line that should be "
+
"wrapped across several rows";

So is it possible to specify where the plus sign should appear in the eclipse java formatter?

Upvotes: 25

Views: 17513

Answers (1)

Deepak Azad
Deepak Azad

Reputation: 7923

Preferences > Java > Code Style > Formatter > Line Wrapping > Binary Expressions > Wrap before Operator

The above controls where + is placed. (Though it should never be on a its own line)

Upvotes: 50

Related Questions