Item Index not finding result

Hi, I have a chunk of text pulled in from ArchiCAD. I want to search through it to find a specific item, but can’t seem to get List Item to return anything other than -1. What am I missing? Is it the syntax I write the search term with?

Looking for this?

1 Like

I guess I am! Thank you! Out of interest, why does List Item work?

1 Like

Instead of “List item” component “List index” is used above.

Sorry, that’s what I meant. Item Index only returns -1 - any idea why?

I changed your topic title…

And look at this post in the old grasshopper forum:

Item Index - Grasshopper (grasshopper3d.com)

the difference between [Member Index] and [Item Index] is basically that Member Index compares values, whereas Item Index compares memory addresses.

So why would you ever need Item Index you ask? Because Member Index can only handle simple data types (numbers, text, points etc.) and also because you might need very specific variable mapping which is not possible when a list contains the same value more than once.

But all in all you will (almost) never need Item Index.

Maybe @DavidRutten could provide an example in which Item Index would make sense?

1 Like

“Item Index” only finds identical values if they reside at the exact same location in memory. In this case, the text in the list and the text you are searching for are indeed the same text, but they are stored in different memory locations. So result will be -1.
You can use “Member index” component instead of “Item index”.

Better they have to rename this “Item Index” component.

1 Like

Agreed, but I can’t now or it’ll invalidate any tutorials or documentation which mention the old names.

1 Like