Building a Sort Method that Ignores Preceding Values


This guide examines the process needed for building a sorting mechanism that ignores preceding values such as bullet points.


Build a method that properly sorts an array of states, even when the elements contain additional preceding values

Exercise File

Code File

Exercise Description

Given the following array of strings:

['- AZ', 'KY', '* FL', '-- AR']

Build out a method that ignores the preceding values and simply sorts by the state values.

Expected Output

['-- AR', '- AZ', '* FL', 'KY']

Real World Usage

It’s great when we have clean data to work with in a program. However, many applications require you to build out parsing tools that only extract the needed values. This exercise walks through how to parse an array of strings and return a properly sorted array.


Can be found on the solutions branch on github.


Please enter your comment!
Please enter your name here