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 trialTojo Alex
Courses Plus Student 13,331 PointsDesperate help needed
Please could you tell me what is the answer for question 2 and 3. My head is completely aching from continuously watching the video.
string.Format("The current date and time is .", DateTime.Now)
string.Format("I like and , but I don't like .", "apples", "oranges", "bananas")
11 Answers
Steven Parker
231,268 PointsReplacement tokens in a "format" string are braces with the argument index number (starting at 0) inside them.
Both of the questions you asked about originally can be solved by adding normal tokens in the blank(s). For the one with multiple blanks, each token will have a different number in it.
The other date question requires a special formatting specifier. For that, you can use one of the standard date/time format strings described in the documentation page I just linked.
Here's an excerpt from that documentation page:
"f" Full date/time pattern (short time). Monday, June 15, 2009 1:45 PM
"F" Full date/time pattern (long time). Monday, June 15, 2009 1:45:30 PM
"g" General date/time pattern (short time). 6/15/2009 1:45 PM
"G" General date/time pattern (long time). 6/15/2009 1:45:30 PM
You want the single-letter format specifier that matches the description in the instructions.
I'll bet you can get it now.
Tojo Alex
Courses Plus Student 13,331 PointsSorry about that . Also in my question I said that I had a problem with this : string.Format("I like and , but I don't like .", "apples", "oranges", "bananas"). Well that was wrong,I have the answer to that question it is actually this one : string.Format("The current date is .", DateTime.Now.Date). Could you explain what to do here.
Steven Parker
231,268 PointsI expanded my answer a bit more.
Tojo Alex
Courses Plus Student 13,331 PointsI couldn't find anything that matched the instructions either that its not there or that I missed it (which probably is the reason why). I'm just really stressed because when I finish this I finish a whole track.
Tojo Alex
Courses Plus Student 13,331 PointsI deleted it now
Tojo Alex
Courses Plus Student 13,331 PointsI worked out the first one that I originally asked though the second one that I asked still confuses me.
Tojo Alex
Courses Plus Student 13,331 Pointsnow I am on a roll
Tojo Alex
Courses Plus Student 13,331 PointsI worked out the answer thanks for assistance. The annoying thing though is that this test won't let you off 2 out of 3. The first question is what is getting on my nerves.(edited)
Steven Parker
231,268 PointsI think passing a quiz requires 80%, so you can't get any wrong when the quiz has less than 5 questions.
Tojo Alex
Courses Plus Student 13,331 Pointsoh ok that is fair
kathyvuong
9,299 PointsThis works for me.........
string.Format("I like {0}_ and {1}, but I don't like _{2}__.", "apples", "oranges", "bananas")