我需要在变量中存储一个多行字符串:
dim str as string = "
some words
some words
some
words
"
如何?
无需使用类来插入新行,您可以这样做:
Dim Logo As String= <a><![CDATA[
___ ___ _ _ _ _ _
| \/ | | || | (_)| |(_)
| . . | _ _ | || |_ _ | | _ _ __ ___
| |\/| || | | || || __|| || || || '_ \ / _ \
| | | || |_| || || |_ | || || || | | || __/
\_| |_/ \__,_||_| \__||_||_||_||_| |_| \___|
_____ _ _
/ ___|| | (_)
\ `--. | |_ _ __ _ _ __ __ _
`--. \| __|| '__|| || '_ \ / _` |
/\__/ /| |_ | | | || | | || (_| |
\____/ \__||_| |_||_| |_| \__, |
__/ |
|___/
]]></a>.Value
Console.WriteLine(Logo)
VB.Net 没有这样的功能,它不会出现在 Visual Studio 2010 中。
在 VB.NET中查找多行字符串以获取解决方法
弄成这样。。
dim str as string = "some words" & vbCrlf & "some words" & vbCrlf & "some" & vbCrlf & "words"
或者用 vbLf 试试
您可以为此使用 XML
dim vrstr as string = <s>
some words
some words
some
words
</s>