I have an array list that I need to modify to get rid of all the entries starting from the word that contains the period and earlier.
For example :
arrayList(0)= My
arrayList(1)= Name
arrayList(2) = Is
arrayList(3) = David.
arrayList(4) = How
arrayList(5) = Are
I need to remove arrayList(0-3)
I tried using:
dim pIndex = arrayList.LastIndexOf(arraylist.contains("."))
arrayList.RemoveRange(0,pIndex)
but just returns pIndex=-1 (meaning it can't be found)
How can I get the index of the entry with a period?
LastIndexOf
returns the index of a specific element.contains
returnTrue
orFalse
if the list contains or not the element yo pass as parameter. Following your example,arrayList.contains(".")
returnsFalse
because none of the elements of the list is "."; thenarrayList.LastIndexOf(false)
returns -1 because none of the elements of the list isFalse
.You need to iterate throught the list:
(Not tested, but it should do the work)