改变eclipse格式化程序包装长字符串的方式 [英] Change how eclipse formatter wraps long strings

查看:94
本文介绍了改变eclipse格式化程序包装长字符串的方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经设置了eclipse java格式化程序来包装超过120个字符的行,以符合我们团队的编码标准。但是,当我有一个包裹的长字符串时,我希望加号(+)显示为第一行的最后一个字符,例如

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";

那么可以指定加号应该出现在eclipse java格式化程序中的哪个位置吗?

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

推荐答案

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)

这篇关于改变eclipse格式化程序包装长字符串的方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆