How to use index-of operation in Function on sequence Using XPath in Xml

In this article I will explain index-of operation of function on sequence.
  • 1700
Introduction

Their are several functions on sequences presents in XPath, Hear in this article I will explain the index-of operation which is used to returns the positions within the sequence of items that are equal to the search item argument.

Syntax
 
index-of((item,item,item.......),searchitem)

The first arguments in the index-of function is the number of item list where we want to search the second argument that is searchitem and returns its occurrence positions in the items list.

Example

index-of((10,20,30,28,20),15)
index-of(("hello","how","are","you","hello"),"hello")
index-of((20,10,25,20),20)
index-of((10,20,25,32,35,25,20,98),25)

Output

()
(1,5)
(1,4)
(3,6)

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.