[Solved] Best way to sort a string of key value pairs

Here is a quick and dirty playground example. It punts entirely on error handling for the sake of brevity.

If your input string is quite long, then you may want to parse it into structured data upfront rather than (re)parsing for each comparison. Or, as @BatmanAoD mentioned, see if you can prep the data beforehand.

1 Like