February 28 - Build a Hashtag Generator Method in Ruby
This guide examines how you can open up the String class and convert all of the words in a sentence into hashtags that can be utilized via social media outlets.
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
Open up the String class in Ruby and build a hashtag generator method.
Exercise Description
Given a string, implement a method that converts each word into a hashtag and returns a single string of the hashtags.
Sample Input
'fun words that need to be hashtags'
Expected Output
'#fun #words #that #need #to #be #hashtags'
Real World Usage
This is a common feature that you'll be asked to build if you work on Ruby on Rails applications. Essentially this exercise requires you to be able to split a string into separate components, update the formatting of each element, and then combine the components back together.