Convert XmlNode text to integer

The code I'm 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 iIndexto decide that the element in the arraylist is returning to the parent application.

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

What am I doing wrong here?

+4
source share
1 answer

VBScript strings do not have a method .substring(or any of them, these are not objects).

If you want the 1st character to be a number - 1:

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

Set for object references, therefore not applicable here.

+5
source

Source: https://habr.com/ru/post/1526965/


All Articles