DATA = ["Ge_total_EN394" , "p1@5end_chr2:191878874..191878938,-" , "p23@5end_chr2:191839657..191839662,-" , "p2@5end_chr2:191878812..191878823,-"]
I would like to sort the data in ascending order. The function I am using at the moment to sort is following
function sort(s1, s2) {
var s1lower = s1.toLowerCase();
var s2lower = s2.toLowerCase();
return s1lower > s2lower? 1 : (s1lower < s2lower? -1 : 0);
}
however this gives me following output
"Ge_total_EN394" , "p1@5end_chr2:191878874..191878938,-" , "p23@5end_chr2:191839657..191839662,-" , "p2@5end_chr2:191878812..191878823,-"
The p23 is sitting before p2, which is not correct . I am not sure how to sort data properly so that p2 comes before
p2@...string come beforep23@...? What is the formal sorting rule for that?3(charcode 51) is less than@(charcode 64)