Forum Discussion

btpoole's avatar
btpoole
Channel Surfer
11 years ago

roList Element

Having hard time on something. I have used roRegex split to separate a long string. According to the sdk this breaks the string into a roList. Well, the sdk for roList gives example of printing elements by using simple loop thru the index. It also shows you can use list[index number] to print specific element. I have tried the following based on the sdk but get errors.

This is from sdk to use split:

r = CreateObject("roRegex", "/+", "")
r.Split(currentlocation)

So once this is done I should have a rolist called r made up of the elements from the split, which in this case is only 3 parts.
I have reference the sdk for the rolist below. I should able to loop thru the list and print all elements or use r to print a specific.


r.ResetIndex()
x= r.GetIndex()
while x <> invalid
print x
x = r.GetIndex()
end while



Now when I step thru the rolist r I get error that member function not found referencing the line
r.ResetIndex()

I am assuming I don't understand completely, can I get some guidance on this.
Thanks

2 Replies

  • r is an roRegex, not an roList. r.Split() returns a list, it doesn't change the roRegex into an roList. You need to do something like

    list = r.Split(currentlocation)

    Then you can iterate the list using your GetIndex code with "r" replaced by "list", or simply

    for each x in list
    print x
    end for


    --Mark
  • btpoole's avatar
    btpoole
    Channel Surfer
    Thanks Markn, I was under the impression that the split created the list but I understand now.
    Thanks