ok, sorry, yes there is a need to first set the column to NUMBER instead TEXT
http://processing.github.io/processing-javadocs/core/processing/data/Table.html#setColumnType-int-int-

i told you the “table” way is just a first idea.
but in this time would easily made your own loadstring // sort array // version
( and possibly would have learned more about loops …)
but usually a csv file has a header ( column name )
example v0.3
// https://discourse.processing.org/t/processing-3-0-how-to-sort-string-array-by-value-of-substrings/6436
// https://processing.org/reference/loadTable_.html
// https://processing.org/reference/Table_sort_.html
// https://processing.org/tutorials/data/
// http://processing.github.io/processing-javadocs/core/processing/data/Table.html#setColumnType-int-int-
// v 0.2 change from tsv to csv
// v 0.2 use col 2 as INT so get a number sort instead a lexical sort
// v 0.3 make header
String infilename = "data/bookmarks.txt";
String outfilename = "data/bookmarks_sort.txt";
Table mytable;
int tcols, trows, numcol = 2;
boolean dprint = true;
void getf_tabledata() { // get tabledata from file
mytable = loadTable(infilename, "header, csv");
tcols = mytable.getColumnCount();
if (dprint) println("total cols in table: "+tcols);
trows = mytable.getRowCount();
if (dprint) println("total rows in table: "+trows);
if (dprint) println("header: ");
for ( int i =0; i < tcols; i++) {
if (dprint) println("headerline col: "+i+" "+ mytable.getColumnTitle(i));
}
}
void sort_tabledata() { // sort numerically a specific column
mytable.setColumnType(numcol, Table.INT);
mytable.sort(numcol);
if (dprint) println("list all rows column "+numcol+" sorted by number");
for ( int i = 0; i < mytable.getRowCount(); i++ ) {
TableRow thisrow = mytable.getRow(i);
if (dprint) println("row "+i+" "+thisrow.getInt(numcol));
}
}
void save_tabledata() { // save to other file
saveTable(mytable, outfilename, "csv");
}
void setup() {
getf_tabledata();
sort_tabledata();
save_tabledata();
exit();
}
/*
data/bookmarks.txt
content:
col a,col b,col c
a,aaaa,1
b,asda,23
c,bsad,12
d,qwea,1222313
e,erew,1222
f,sdah,123422313
g,qwer,17
*/