Inserting a String to a specific position of the array

Hi Guys!

i have this array

InformationList = {“name”, “lastname”, “age”, “Date of birth”}

I’m trying to insert a string into position 2 of this array.

exemplo: InformationList = {“name”, “lastname”, “x” ,“age”, “Date of birth”}

I tried to use the activities ADD TO COLLECTION… but I’m not getting to create the code correctly

Hi,

Can you try the following?

InformationList = InformationList.Take(2).Concat({"x"}).Concat(InformationList.Skip(2)).ToArray()

or

listVar = InformationList.ToList
listVar.Insert(2,"x")
InformationList=listVar.ToArray

note: listVar is List<string>

Regards,

1 Like

Hi! The First solution Worked!

Thanks! :slight_smile:

1 Like

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