About breaking a string
Hi guys, we all know that sun code conventions recommend us break before an operator while wrapping lines. That means if yor are wrapping a string like this:
String s = "This is a very, very, very, very, long string";
The result should be:
String s = "This is a very, very, very, very, long "
+ "string";
But in fact, what I get in IDEA is like this:
String s = "This is a very, very, very, very, long " +
"string";
I think maybe the sun code conventions is preferred. If you guys don't like sun(just kidding), you can add an option to code style panel.
请先登录再写评论。
I would prefer an option. My habit is to put the operator at the end of the
first line, to emphasize that the line is continued.
"Jason Hao" <biubiu@163.com> wrote in message
news:1466480.1037274548619.JavaMail.jrun@is.intellij.net...
an operator while wrapping lines. That means if yor are wrapping a string
like this:
>
>
>
>
>
>
like sun(just kidding), you can add an option to code style panel.
>
Definitely - for some of us line continuation characters are an established part of coding practice ;) I don't understand Sun's position on this one.
Look at this:
String s = "absasldfjs" +
"asdfjaslkjf";
If the first line were very long the plus may go off the right-hand edge of the screen, leaving the second line at a casual glance looking like a separate line.
Now look at the alternative:
String s = "aslkdfgaf"
+ "alskjdfkasdjf";
No chance of that happening now.
Cheers,
Bryan
Not a problem if you don't have really long lines :)
"Bryan Dollery" <Bryan.Dollery@ChaosEngineers.co.nz> wrote in message
news:2134806.1037609388792.JavaMail.jrun@is.intellij.net...
>
>
of the screen, leaving the second line at a casual glance looking like a
separate line.
>
>
>
>
>
>