将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))) - 1I 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)) - 1Set用于对象引用,因此不适用于此处。
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)) - 1Set is for object references so is not applicable here.
更多推荐
发布评论