Share via


Req3: multiline strings

[This post is part of a series, "wish-list for future versions of VB". Just to note, I've been reading everyone's comments -- thank you everyone for the feedback -- but I want to finish putting up the entire list before I get round to responding.]

 

IDEA: Multiline strings. VB should allow multiline strings:

        Dim s = @"This is a multiline string

which can include line-breaks

and\ttab\nescape character and < and > and &"

 

Note VB already has other ways to write multiline strings:

        Dim t = <![CDATA[this is a multiline string

which can include line-breaks

not escape characters but it can do < and > and &]]>.Value

        Dim u = <xml>this is a multiline string

which can include line-breaks

and&#9;tab&#13;&#10;escape characters but not &lt; or &gt; or &amp;</xml>.Value

 

Provisional evaluation from VB team: This is a decent idea, worth considering against the other decent ideas.

Comments

  • Anonymous
    February 12, 2010
    +1 I like the idea of multiline strings, and I also like idea of using C#-like escape sequences. I'm sick of "aaa" & vbCrLf & "bbb"

  • Anonymous
    February 12, 2010
    The comment has been removed

  • Anonymous
    February 13, 2010
    +1 from me!!   I was stoked to see that they actually thought it was a good idea! Would love to see this feature in the future!!

  • Anonymous
    February 15, 2010
    The comment has been removed

  • Anonymous
    February 18, 2010
    I like the idea OK, but I too use the XML trick to do this.  So I'd call it a nice-to-have, but far from essential.

  • Anonymous
    February 23, 2010
    We don't need this feature. We can just use an extension method called 'Unescape' to do that. Dim s = "This is arnmultiline string".Unescape

  • Anonymous
    February 24, 2010
    Worth considering - easier to write and more visually pleasing than the xml and cdata examples.