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 trialTaylor Quinn
20,003 PointsFor the method on a string that compares it to another string is the method .equals?
I have been using .equals for the question but have not been getting it right. What am i doing wrong?
4 Answers
Christopher Augg
21,223 PointsTaylor,
The question is not asking you to compare the Strings. You would use .equals if that were the case. However, it asks the following:
"Which method on String will allow you to check if a String is part of another."
String someWords = "These are words";
someWords.__________("words");
Do you recall what to use to see if a String contains another String? i.e. Does someWords contain "words"?
Please let me know if this helps.
Regards,
Chris
victorhuang
4,322 PointsCan someone explain the method of contains stands for? I Haven't seen its introduction in earlier videos or might just skipped that.
deandede
1,433 Pointsme too I didnt come across such teach...i was wondering when did craig teach that contain parts LOL
Taylor Quinn
20,003 Points.contains.....So simple yet still got by me. Thank you
uztaygorzn
448 Pointsi didn't see this either.