将XmlNode文本转换为整数(Converting XmlNode Text to Integer)

编程入门 行业动态 更新时间:2024-10-19 21:36:11
将XmlNode文本转换为整数(Converting XmlNode Text to Integer)

我试图使用的代码就是这个。

Dim oNode Set oNode = XmlDoc.SelectSingleNode("/Record/CelloXml/Integration/Case/Hearing/Court/NodeID") Dim iIndex Set iIndex = (CInt((oNode.Text).substring(0,1))) - 1

我想使用iIndex来决定arraylist中的元素以返回到父应用程序。

我目前得到的错误是我需要oNode.Text的文本对象

我在这做错了什么?

The code that I am trying to use is this.

Dim oNode Set oNode = XmlDoc.SelectSingleNode("/Record/CelloXml/Integration/Case/Hearing/Court/NodeID") Dim iIndex Set iIndex = (CInt((oNode.Text).substring(0,1))) - 1

I want to use the iIndex to decide the element in an arraylist to return to the parent application.

The error that I am getting currently is that I need a text object inside the oNode.Text

What am I doing wrong here?

最满意答案

VBScript字符串没有.substring方法(或者任何方法,它们不是对象)。

如果你想把第一个字符作为数字 - 1:

Dim iIndex iIndex = clng(left(oNode.Text, 1)) - 1

Set用于对象引用,因此不适用于此处。

VBScript strings do not have a .substring method (or any method for that matter, they are not objects) .

If you want the 1st character as a number - 1:

Dim iIndex iIndex = clng(left(oNode.Text, 1)) - 1

Set is for object references so is not applicable here.

更多推荐

本文发布于:2023-04-28 06:38:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1330308.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:整数   转换为   文本   XmlNode   Text

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!