Let’s say I have an array of strings (string):
a = { “aaa”, “zzz”, “eee”, “uuu”, “kkk”, “sss” };
Suppose I need its sub-array starting from a[2] /“eee”/ to a[4] /“kkk”/, so I get a new array:
b = { “eee”, “uuu”, “kkk” };
How do I do that? Is there something like:
b = a.Slice(2, 4);
Off the cuff, you could make a function that does what you need.
Ignore the first [0] index if need be and run a quick for loop through the “a” array.
Here is some pseudocode (not ignoring the zero):
Array b = new Array
for(int i=0; i<a.length; i++){
if(i % 2 == 0){ // mod returns a remainder after division. 0 remainder = even number
// even number
// add to new array
}
else{
// odd number
}
}
Hope this helps!
~blot