String continuation on next line

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Don Leckie

    #1

    String continuation on next line

    Hi,

    I've searched all my Java books ans newsgroup archives and found nothing.
    Once I thought that I saw a character at the end of a line allowed a String
    literal to span multiple lines.

    I have some XSLT code that I want to write out with one println( )
    statement. The XSLT code is several lines long.

    Does anyone remember a String literal line continuation character?

    Thank you,
    Don


  • David Moss

    #2
    Re: String continuation on next line

    In article <hr6dnawtf8TI1I beRVn-jg@adelphia.com >, don@leckieinc.c om
    writes...
    [color=blue]
    > Hi,
    >
    > I've searched all my Java books ans newsgroup archives and found nothing.
    > Once I thought that I saw a character at the end of a line allowed a String
    > literal to span multiple lines.
    >
    > I have some XSLT code that I want to write out with one println( )
    > statement. The XSLT code is several lines long.
    >
    > Does anyone remember a String literal line continuation character?[/color]

    Too much VB can affect you that way ;-)
    "VB is a popular Australian beer " & _
    "as well as Visual Basic)

    AFAIK there is no such thing in Java.

    String answer = "Java statements continue " +
    "from line\nto line\n" +
    "until they are terminated with a semicolon, " +
    "so there is no need for any special construct";
    System.out.prin tln(answer);

    --
    DM
    personal opinion only

    Comment

    • Don Leckie

      #3
      Re: String continuation on next line

      Hi David,

      Thank you. Guess I was dreaming that I once saw it.

      Don


      "David Moss" <q0320811@mail. connect.usq.edu .au> wrote in message
      news:MPG.1d86cc c3234a3bca98981 f@news.bigpond. com...[color=blue]
      > In article <hr6dnawtf8TI1I beRVn-jg@adelphia.com >, don@leckieinc.c om
      > writes...
      >[color=green]
      >> Hi,
      >>
      >> I've searched all my Java books ans newsgroup archives and found nothing.
      >> Once I thought that I saw a character at the end of a line allowed a
      >> String
      >> literal to span multiple lines.
      >>
      >> I have some XSLT code that I want to write out with one println( )
      >> statement. The XSLT code is several lines long.
      >>
      >> Does anyone remember a String literal line continuation character?[/color]
      >
      > Too much VB can affect you that way ;-)
      > "VB is a popular Australian beer " & _
      > "as well as Visual Basic)
      >
      > AFAIK there is no such thing in Java.
      >
      > String answer = "Java statements continue " +
      > "from line\nto line\n" +
      > "until they are terminated with a semicolon, " +
      > "so there is no need for any special construct";
      > System.out.prin tln(answer);
      >
      > --
      > DM
      > personal opinion only[/color]


      Comment

      Working...