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! While you're at it, check out some resources Treehouse students have shared here.

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


Putting a space after typing dork makes the noun.equals("dork") useless. How to solve that? Thanks!!

As I say, I just need to push the spacebar to avoid java recognizing "dork " as equal to "dork". How can we make java to only cosinder the combination of letters that makes the word dork without consider the space before or after the word?

2 Answers

Jason Anders
Jason Anders
Treehouse Moderator 145,858 Points

Hey Andrea,

That's a really great observation and question! :thumbsup:

To isolate the string only, you would use the trim() method, which removes any leading and trailing whitespace. You can read up on it in the Official Java Docs, or have a look at this example from "GeeksforGeeks".

Hope that helps you! :) :dizzy:

Thank you very much, Jason!! :)