Hi All,
I want to extract the array elements of every 7th position and store in another array.
Please help
Hi All,
I want to extract the array elements of every 7th position and store in another array.
Please help
Hi @thima take one assign activity and assign like this new array_varible = old_array(6) six means you will get 7 the position element .
Hi @thima,
1.You can do like this for storing into the other variable.
other_array_varriable =array.AsEnumerable().Skip(7).Take(array.length-1).ToArray
If you find this useful mark it as solution.If any doubts ping me.
Cheers,
Vashisht.
With array it is not possible to add items in a loop or iterative way.
Please follow these steps.
Convert your array to List. Declare a variable lst
of type String
lst = New List<Of String>
Assign Activity lst = arr.OfType(Of String).ToList
Declare a new array to store every 7th element.
arr_7 = New Array
Assign Activity arr_7 = lst.Where(Function(x, i) i > 0 AND i Mod 7 = 0).ToArray()
arr_7 contains all 7th position elements.
Sample VB.Net code and result -
Regards,
Karthik Byggari
Thank you its working
Hey @KarthikByggari
Can we extract a part of array? I mean is it possible to extract 3 arrays of 9 elements from an array of 27?
In your screenshot there are 16 elements in the array so can we extract two arrays of 8 elements as follows:
Array1 = {βAβ,βBβ,βCβ,βDβ,βEβ,βFβ,βGβ,βHβ}
Array2 = {βIβ,βJβ,βKβ,βLβ,βMβ,βNβ,βOβ,βPβ}