Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial

soufiane bennaiym
Courses Plus Student 217 Pointssinatra
hi, possible modus operandi of this code in the sinatra : str.squish.downcase.tr(" ","_")
1 Answer

Adam Robertson
3,294 PointsIt looks like it's attempting to underscorize the string. squish
trims whitespace from the ends of the string, and replaces all multiple whitespace characters with a single one. downcase
will make the string lowercase. tr
will replace the character " " with the character "_". This isn't a great implementation of underscorizing, however, because it won't remove characters that aren't a-zA-Z, if that was the intention.