(Processing 3.0) how to sort string array by value of substrings?

Hello, your solution works well. i changed the gaps in the text file from random spaces to the commas you mentioned to follow the csv format:

a     a     1
aghf    bsad     12
aasd    asdasa     23
hlkjojto     erewrui     1222
ytyi     qwea     1222313 
aerwjdu     sdahdsu     123422313
a,a,1
aasd,asdasa,23
aghf,bsad,12
ytyi,qwea,1222313
hlkjojto,erewrui,1222
aerwjdu,sdahdsu,123422313

this is then the output of bookmarks_sort.txt:

a,a,1
aghf,bsad,12
hlkjojto,erewrui,1222
ytyi,qwea,1222313
aerwjdu,sdahdsu,123422313
aasd,asdasa,23

thanks for your time :slight_smile:

however, i want to know if its possible to replace the inbuilt sort you used here:

mytable.sort(2);

i want to replace the inbuilt sort with a custom bubble and insertion sort, so that it sorts the third row based on numerical value rather than only the first digit. basically what i am saying is that instead of sorting the file like this:

a,a,1
aghf,bsad,12
hlkjojto,erewrui,1222
ytyi,qwea,1222313
aerwjdu,sdahdsu,123422313
aasd,asdasa,23

i want to sort the last numbers based on how big they are, like this:

a,a,1
aghf,bsad,12
aasd,asdasa,23
hlkjojto,erewrui,1222 
ytyi,qwea,1222313 
aerwjdu,sdahdsu,123422313 

it would be fantastic if you show me how to do it via bubble and/or insertion sort.