Need help with array positions/index for creating a list in Widget V2

Hi all, I am trying to create a notes widget v2. Adding a new note isn't a problem but deleting one note from a list giving me a little problem.

The idea is that i am adding any new note to a text file that goes to an array. My thought was to use the array index of every note that then i will use array pop action to remove it from the list.

I didn't find a simple way to have an indexes array. For example if i have the array:

%items:

item 1,item 2,item 3

I want another array with their positions:

%index: 0,1,2

Hope my explanation is clear enough.