Microsoft XML SDK 2.6 - XML Reference

substringData Method

Retrieves a substring of the full string from the specified range.

strValue = oXMLDOMCharacterData.substringData(offset, count)

Parameters

offset
Long integer value indicating the offset, in characters, from the beginning of the string. An offset of zero indicates copying from the start of the data.
count
Long integer value indicating the number of characters to retrieve from the specified offset.

Return Value

String. Returns the substring.

Remarks

If the offset and count parameters indicate a range beyond the end of the string, the returned substring continues only until the end of the string data.

Example

The following VBScript example creates an XMLDOMComment object (comment), and then uses the substringData method to retrieve the first five characters of the object:

Dim xmlDoc
Dim comment
Dim MyStr
Set xmlDoc = CreateObject("Msxml2.DOMDocument")
xmlDoc.async = False
xmlDoc.load("c:\books.xml")
Set comment = xmlDoc.createComment("Hello World!")
MyStr = comment.subStringData(0,5)
msgbox strValue

See Also

Applies To: XMLDOMCDATASection Object | XMLDOMCharacterData Object | XMLDOMComment Object | XMLDOMText Object