Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS Advanced Sass Advanced Functions Strings

Kabolobari Benakole
PLUS
Kabolobari Benakole
Courses Plus Student 14,278 Points

What am I doing wrong

style.scss
$words: 'this is the first string';
$new-words: str-insert($words, 'not ', 2);

.block {
  content: $new-words;
}

1 Answer

Steven Parker
Steven Parker
218,635 Points

You're really close! It looks like you're setting the index for "str-insert" to be the number of words to skip.

But it should be the number of characters to skip instead.

Kabolobari Benakole
Kabolobari Benakole
Courses Plus Student 14,278 Points

Hi, Stephen, thanks for your answer. But I still don't get it. I'm supposed to insert the new word "not" at index position 2, counting from 0 right of the $words string. And that's what I thought I've done by the syntax.

I tried

$words: 'this is the first string';
$new-words: str-insert($words, ' not ', 7);

.block {
  content: $new-words;
}

and still got "Bummer: The 'content' attribute for the .block element is not correct. Did you call the str-insert function with the right arguments?"

Steven Parker
Steven Parker
218,635 Points

You're almost there!
You only need to add one new space with the word (as you had originally). And the position is off by one:

$new-words: str-insert($words, 'not ', 8);