Hey there everyone. First, i know this has been answered before but only partly. So here goes my question, i’ll try to be as quick as possible
Say i have 8 dynamically constructed string arrays using a way described below:
var array1 = decryptedData[0].ToString().Split(";"[0]); //decryptedData is a variable also filled dynamically
var array2 = decryptedData[1].ToString().Split(";"[0]);
var array3 = decryptedData[2].ToString().Split(";"[0]);
var array4 = decryptedData[3].ToString().Split(";"[0]);
var array5 = decryptedData[4].ToString().Split(";"[0]);
var array6 = decryptedData[5].ToString().Split(";"[0]);
var array7 = decryptedData[6].ToString().Split(";"[0]);
var array8 = decryptedData[7].ToString().Split(";"[0]);
Then, to be able to control all these data easliy and specifically to sort them properly like you would do in a data table; I create a multidimensional 2d array from them using this:
var BIGARRAY = [array1,array2,array3,array4,array5,array6,array7,array8];
So the question is; how do i sort all of them according to e.g. array2 ?
All arrays are strings but some of them are actually numbers as strings if that helps.
Being not even sure if that’s a correct syntax, tried this with failure;
System.Array.Sort(BIGARRAY, mySorting);
function mySorting(a,b) {
var str1 = a[0][0];
var str2 = b[0][0];
var n = str1.localeCompare(str2);
return n;
}