www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Multiline string constants

reply "Andrew Fedoniouk" <news terrainformatica.com> writes:
Take a look on this code:

      (this ~= new HtmlPanel()).load(
        "<HTML><H1 padding=3px back-color='edit dialog'>H1:This is <I>HTML 
text</I> loaded into <B>HTMLPanel</B> - simple non scrollable HTML 
container.</H1>"
          "<P>Image:<IMG src='c:/test.png'/> </P>"
          "<P><CODE>code example;</CODE></P>"
          "<P>And here goes the Table:</P>"
          "<TABLE cellspacing=10px cellpadding=10px padding=10px 
border-width=1px border-style=solid border-color=dialog-shadow >"
            "<TR>"
              "<TD width=30%>one: <INPUT type=text value='hello world' 
width=100px /></TD>"
                   "<TD>two</TD><TD width=40 back-color='dialog-light 
scrollbar' border='1px solid dialog-shadow'>1</TD>"
            "</TR>"
            "<TR>"
              "<TD border='1px solid dialog-shadow'>three 
three</TD><TD>four</TD><TD back-color='dialog-light scrollbar' border='1px 
solid dialog-shadow'>2</TD>"
            "</TR>"
            "<TR>"
              "<TD colspan=2 back-color='dialog-light 
dialog-shadow'>colspan=2</TD><TD back-color='dialog-light dialog-light 
scrollbar dialog-shadow'>3</TD>"
            "</TR>"
          "</TABLE>"
          "<P>Hyperlink test: <A href='http://terrainformatica.com'>Terra 
Informatica</A></P>"
        "</HTML>");

Ugly, isn't it ?

It would be just nice if it will be possible to say

this ~= new (HtmlPanel()).load(
<+
my multiline string
constant
+> );

PHP does have something like this. But D is not PHP and PHP is not D.
Apr 14 2005
next sibling parent reply Ant <duitoolkit yahoo.ca> writes:
Andrew Fedoniouk wrote:
 Take a look on this code:
 
       (this ~= new HtmlPanel()).load(
         "<HTML><H1 padding=3px back-color='edit dialog'>H1:This is <I>HTML 
 text</I> loaded into <B>HTMLPanel</B> - simple non scrollable HTML 
 container.</H1>"
           "<P>Image:<IMG src='c:/test.png'/> </P>"
           "<P><CODE>code example;</CODE></P>"
           "<P>And here goes the Table:</P>"
           "<TABLE cellspacing=10px cellpadding=10px padding=10px 
 border-width=1px border-style=solid border-color=dialog-shadow >"
             "<TR>"
               "<TD width=30%>one: <INPUT type=text value='hello world' 
 width=100px /></TD>"
                    "<TD>two</TD><TD width=40 back-color='dialog-light 
 scrollbar' border='1px solid dialog-shadow'>1</TD>"
             "</TR>"
             "<TR>"
               "<TD border='1px solid dialog-shadow'>three 
 three</TD><TD>four</TD><TD back-color='dialog-light scrollbar' border='1px 
 solid dialog-shadow'>2</TD>"
             "</TR>"
             "<TR>"
               "<TD colspan=2 back-color='dialog-light 
 dialog-shadow'>colspan=2</TD><TD back-color='dialog-light dialog-light 
 scrollbar dialog-shadow'>3</TD>"
             "</TR>"
           "</TABLE>"
           "<P>Hyperlink test: <A href='http://terrainformatica.com'>Terra 
 Informatica</A></P>"
         "</HTML>");
 
 Ugly, isn't it ?
 
 It would be just nice if it will be possible to say
 
 this ~= new (HtmlPanel()).load(
 <+
 my multiline string
 constant
 +> );
 
 PHP does have something like this. But D is not PHP and PHP is not D.
 
 
 
 
 
this is valid: void main() { printf("hello there and over there and to the left\n"); } produces hello there and over there and to the left Ant
Apr 14 2005
parent jicman <jicman_member pathlink.com> writes:
While we're on this subject, it would be nice to that r" be exactly what is
suppose to be.  For example, 

char[] str;
str = r"
many
many
lines
to
add
and more

and even more

and end it.";

This would be nice.  Python has the """ which ends with """ and anything in
between is a string.  But, r" should be


Ant says...
Andrew Fedoniouk wrote:
 Take a look on this code:
 
       (this ~= new HtmlPanel()).load(
         "<HTML><H1 padding=3px back-color='edit dialog'>H1:This is <I>HTML 
 text</I> loaded into <B>HTMLPanel</B> - simple non scrollable HTML 
 container.</H1>"
           "<P>Image:<IMG src='c:/test.png'/> </P>"
           "<P><CODE>code example;</CODE></P>"
           "<P>And here goes the Table:</P>"
           "<TABLE cellspacing=10px cellpadding=10px padding=10px 
 border-width=1px border-style=solid border-color=dialog-shadow >"
             "<TR>"
               "<TD width=30%>one: <INPUT type=text value='hello world' 
 width=100px /></TD>"
                    "<TD>two</TD><TD width=40 back-color='dialog-light 
 scrollbar' border='1px solid dialog-shadow'>1</TD>"
             "</TR>"
             "<TR>"
               "<TD border='1px solid dialog-shadow'>three 
 three</TD><TD>four</TD><TD back-color='dialog-light scrollbar' border='1px 
 solid dialog-shadow'>2</TD>"
             "</TR>"
             "<TR>"
               "<TD colspan=2 back-color='dialog-light 
 dialog-shadow'>colspan=2</TD><TD back-color='dialog-light dialog-light 
 scrollbar dialog-shadow'>3</TD>"
             "</TR>"
           "</TABLE>"
           "<P>Hyperlink test: <A href='http://terrainformatica.com'>Terra 
 Informatica</A></P>"
         "</HTML>");
 
 Ugly, isn't it ?
 
 It would be just nice if it will be possible to say
 
 this ~= new (HtmlPanel()).load(
 <+
 my multiline string
 constant
 +> );
 
 PHP does have something like this. But D is not PHP and PHP is not D.
 
 
 
 
 
this is valid: void main() { printf("hello there and over there and to the left\n"); } produces hello there and over there and to the left Ant
Apr 14 2005
prev sibling parent reply Thomas Kuehne <thomas-dloop kuehne.thisisspam.cn> writes:
http://digitalmars.com/d/lex.html -> "alternate form of wysiwyg"
Apr 14 2005
parent "Andrew Fedoniouk" <news terrainformatica.com> writes:
Thanks, guys.

"Thomas Kuehne" <thomas-dloop kuehne.thisisspam.cn> wrote in message 
news:d6f3j2-afe.ln1 lnews.kuehne.cn...
 http://digitalmars.com/d/lex.html -> "alternate form of wysiwyg"

 
Apr 14 2005