Building a Sort Method that Ignores Preceding Values

0
835

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

Summary

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.

Solution

Can be found on the solutions branch on github.

LEAVE A REPLY

Please enter your comment!
Please enter your name here