How to get values between two Topic?

You can convert to List.
For example, if values are in an array, you can convert to List

list = new List<int>(intArray)
or
list = array.ToList

IndexOf returns the index of the value found in a list.
Get Range gets the list of values from the given index and number of elements.
GetRange(intIndex, intNumberOfElements)

For Example,

list contains the following values -

Topic 1
Text 1
Text 2
Text 3
Topic 2
Text 1
Text 2
Text 3
Topic 3

IndexOf(“Topic 1”) - returns 0
IndexOf(“Topic 2”) - returns 4
IndexOf(“Topic 3”) - returns 8

GetRange(IndexOf(“Topic 1”) +1, 4 - (IndexOf(“Topic 1”)+1)) - returns the values from index 1 to index 3.

Result:
Text 1
Text 2
Text 3

Regards,
Karthik Byggari

1 Like