I have some codes looking like the one of following:
aaa_bbb_d2_aa
aaa_bbb_d3_aa
aaa_bbb_d11_aaeee_b2b_c2_ac
In general they should be sorted as strings, however in case of “aaa_bbb_d3_aa” vs. “aaa_bbb_d11_aa” the former should come first in contrast to simple string sorting.
The numerical part that is important for sorting always resides after either the “_d” or “_c” substring and always is followed by “_aa” or by “_ac” ending the string.
What is an efficient sorting algorithm in Java or SQL?