Wrapping Strings

6 October 2008

Its always useful to wrap strings if they are too long. This provides better readability. Eclipse has support for this.

String literals can wrapped when you edit them. Place your cursor at the point of literal where you want to wrap and press Enter. For example:

String message= "Java is fun to learn and it sure is a popular programming language.";

I kept the cursor at ‘sure’ and pressed enter key. The String was changed to:

String message= "Java is fun to learn and it sure” +
 “is a popular programming language.";

This behavior can be customized in the Java > Editor > Typing preference page.

del.icio.us:Wrapping Strings  digg:Wrapping Strings  spurl:Wrapping Strings  wists:Wrapping Strings  simpy:Wrapping Strings  newsvine:Wrapping Strings  blinklist:Wrapping Strings  furl:Wrapping Strings  reddit:Wrapping Strings  fark:Wrapping Strings  blogmarks:Wrapping Strings  Y!:Wrapping Strings  smarking:Wrapping Strings  magnolia:Wrapping Strings  segnalo:Wrapping Strings  gifttagging:Wrapping Strings

Top Of Page | Trackback

If you found this page useful, consider linking to it. Simply copy and paste the code below into your web site.

It will look like this: Wrapping Strings

Leave a Reply