Array Manipulation

Hello everyone,
Can anyone help me into this, i have a array datatype, in which i want, if array length is 3 then it will give the value as nam1=arr(0),name2=arr(1),name3=arr(2), but if arr length is greater than 3, then last all arr values should append in one variable like name3=arr(2)+… all left elements.

Please help

1 Like

Hey @Anjali_Rani

Here you go,

name1 = arr(0)

name2 = arr(1)

name3 = String.Join(",",arr.Skip(2))

All the above can be achieved using assign statement.

In the String.Join I have used , as the separator between the strings - You can use your own may be a space, or empty or semicolon as required.

Join will help you in joining the entire elements in the collection & Skip will just ignore the number of items you pass as an argument, In the above case, I have skipped two items.

Thanks
#nK

Thank you so much. :slight_smile:

1 Like

No problem, Welcome

Have a good day :slightly_smiling_face::+1:

1 Like

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