Post Reply 
Sorting Strings
07-10-2017, 05:02 PM
Post: #4
RE: Sorting Strings
A sample list:
{"TOP1", "TOP2", "TOP3", "TOP14", "TOP26", "TOE4", "TOE14", "TOE22", "BOT1", "bot2", "BOT230", "1", "2", "33", "999", "A1", "1A", "5000-B", "M234", "77", "B25", "111C", "1000", "A9", "A10", "A11", "100", "CP1", "CP2", "CP3", "CP4", "CP5"}

Sorted result:
{"1", "1A", "2", "33", "77", "100", "111C", "999", "1000", "5000-B", "A1", "A9", "A10", "A11", "B25", "BOT1", "bot2", "BOT230", "CP1", "CP2", "CP3", "CP4", "CP5", "M234", "TOE4", "TOE14", "TOE22", "TOP1", "TOP2", "TOP3", "TOP14", "TOP26"}

Inputs could be a mix of numbers and other characters. The solution would have to break up the input strings into numerical and non-numerical chunks, then sort the numerical chunks by value, non-numerical chunks by alphabetical order.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Sorting Strings - Jacob Wall - 07-10-2017, 12:18 AM
RE: Sorting Strings - webmasterpdx - 07-10-2017, 04:58 AM
RE: Sorting Strings - Joe Horn - 07-10-2017, 07:22 AM
RE: Sorting Strings - Jacob Wall - 07-10-2017 05:02 PM
RE: Sorting Strings - Tyann - 07-11-2017, 05:03 AM
RE: Sorting Strings - Tyann - 07-11-2017, 06:06 PM
RE: Sorting Strings - Jacob Wall - 07-11-2017, 06:21 PM
RE: Sorting Strings - Didier Lachieze - 07-11-2017, 11:32 PM
RE: Sorting Strings - Gilles59 - 07-12-2017, 08:28 PM
RE: Sorting Strings - Han - 07-12-2017, 12:32 AM
RE: Sorting Strings - Jacob Wall - 07-12-2017, 05:10 AM
RE: Sorting Strings - Jacob Wall - 07-14-2017, 07:02 AM
RE: Sorting Strings - Didier Lachieze - 07-14-2017, 08:11 AM
RE: Sorting Strings - Jacob Wall - 07-15-2017, 03:00 AM



User(s) browsing this thread: 8 Guest(s)