Retreive index from String[] arrays

Hi,
I can’t seem to be able to find a way to extract the index of a particular element from a String array.
I’m sorry if this question has been asked before, I spent around 2 hours looking for a way to do this.

If anyone could help me out here, that would be great.
Thank you!

1 Like

@austendsouza I think you are using wrong syntax see below example

                             assign arrayname={1,2,3,4,5}

                             In message box use this arrayname(0).ToString  so it will give index value ie 1
1 Like

@austendsouza

Array.IndexOf(array_name, "array element to search").tostring

1 Like

Hi Austendsouza,

Try following Code Snippet:

string[] strArr = { "One", "Two", "Three", "Four" };
int idx = Array.IndexOf(strArr, "One");

Regards,
Tuhin

5 Likes

This worked for me, thank you

3 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.