最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【已解决】VB.Net中的多行字符

VB.Net crifan 3465浏览 0评论

【问题】

折腾:

【记录】VB.Net中的正则表达式

的过程中,需要在VB.Net中输入多行字符串。

【解决过程】

1.参考:

Multiline strings in VB.NET

去试试。

2.结果果却又出现其他错误,参见:

【已解决】VB.Net中出错:XML literals and XML axis properties are not available. Add reference to System.xml System.xml.linq and System.Core

3.最后,是通过,确保VB.Net是4.0,然后使用如下类似代码,就可以实现定义多行字符串了:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Imports System.Xml
Imports System.Xml.Linq
 
 
Public Class Form1
 
    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        Dim s As String = <a>Hello
World</a>.Value
 
        Dim inputHtml As String
 
        inputHtml = <a><![CDATA[<div class="d_list_txt" id="d_list">
<ul>
    <li><span class="c_tit">...
    <li><span class="c_tit">...
    <li><span class="c_tit">...
    <li><span class="c_tit">...
    <li><span class="c_tit">...
</ul>
<div class="pagebox">]]></a>.Value
 
 
    End Sub
End Class

 

【总结】

VB.Net中,弄个多行字符串,都烦死了。哎。。。

转载请注明:在路上 » 【已解决】VB.Net中的多行字符

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
84 queries in 0.326 seconds, using 22.00MB memory