[英]How to set a multiline string variable in vbnet
我需要在變量中存儲多行字符串:
dim str as string = "
some words
some words
some
words
"
怎么樣?
無需使用類來插入新行,您可以這樣做:
Dim Logo As String= <a><![CDATA[
___ ___ _ _ _ _ _
| \/ | | || | (_)| |(_)
| . . | _ _ | || |_ _ | | _ _ __ ___
| |\/| || | | || || __|| || || || '_ \ / _ \
| | | || |_| || || |_ | || || || | | || __/
\_| |_/ \__,_||_| \__||_||_||_||_| |_| \___|
_____ _ _
/ ___|| | (_)
\ `--. | |_ _ __ _ _ __ __ _
`--. \| __|| '__|| || '_ \ / _` |
/\__/ /| |_ | | | || | | || (_| |
\____/ \__||_| |_||_| |_| \__, |
__/ |
|___/
]]></a>.Value
Console.WriteLine(Logo)
就這樣..
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>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.