February 11 - 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.
Guide Tasks
- Read Tutorial
- Watch Guide Video
- Complete the Exercise
Video locked
This video is viewable to users with a Bottega Bootcamp license
Already a Bottega Student? Sign In
Summary
Build a method that properly sorts an array of states, even when the elements contain additional preceding values
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.