LexicographicSort
LexicographicSort[{e1,e2,…}] sorts the list of expressions ei in lexicographic order.
LexicographicSort[{e1,e2,…},p] compares elements of the ei expressions using the ordering function p.
Please visit the official Wolfram Language Reference for more details and examples on core symbols.