如何拆分此xml节点以仅获取数字值? spanAll Potatoes: 4/span 像这样的东西: Dim code as string = "spanAll Potatoes: 4/span"Dim splitrsult as stringSplitresult = splitresult("spanAll Potatoes:" "/span")Msgbox(splitresult)
<span>All Potatoes: 4</span>
像这样的东西:
Dim code as string = "<span>All Potatoes: 4</span>" Dim splitrsult as string Splitresult = splitresult("<span>All Potatoes:" & "</span>") Msgbox(splitresult)
我是这种语言的新手,帮助会很感激.谢谢!
将XML作为XML处理! (不是简单的字符串)使用此导入语句
Imports System.Xml.Linq
然后解析您的字符串以获取Xml元素并获取其值
Dim code As String = "<span>All Potatoes: 4</span>" Dim node = XElement.Parse(code) Dim result As String = node.Value ' ==> "All Potatoes: 4"