JDK-4810793 : Add support for python's triple-quote mechanism for coding multi-line strings
  • Type: Enhancement
  • Component: specification
  • Sub-Component: language
  • Affected Version: 1.4.1
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2003-01-30
  • Updated: 2006-11-17
  • Resolved: 2006-11-17
Related Reports
Duplicate :  
Name: rmT116609			Date: 01/30/2003

Python support a triple-quote mechanism that makes it easy to embed multi-line strings in code.  For example:

public void testme()
 // Current java way
 String test =
 "Multi-line text gets added to the variable," + '\n'
 + "including carriage returns.  This process continues"
+ '\n'
 + "until and ending triple quote."

 // Triple-quote way
 test =
"""Multi-line text gets added to the variable,
including carriage returns.  This process continues
until and ending triple quote."""

(Review ID: 180128) 

EVALUATION I'll take a look at Python and try and understand what the rules are. They may or may not fit into Java, and it may not be worthwhile to do this, but we'll see. ###@###.### 2003-01-30