Sass str-insert() Function

You are Here:

Sass str-insert() Function

The str-insert() function returns a copy of a string with a new letter(s) inserted at the specified index.

Example

SASS TO CSS CONVERTER
//Check your console @debug str-insert("sansserif", "-", 5); // "sans-serif" @debug str-insert("sansserif", "-", -6); // "sans-serif" @debug str-insert("sansserif", "-", 100); // "sansserif-" @debug str-insert("sansserif", "-", -100); // "-sansserif"

Syntax

str-insert($string, $insert, $index)

Parameter Value

ValueTypeExplanation
$stringRequiredA string.
$insertRequiredA string to be inserted
$indexRequiredA index number (a position to add 'insert string').

Return Value

ValueExplanation
stringReturns a copy of $string with $insert inserted at $index.
  • If of $index is higher than the length of $string, $insert is added to the end.
  • If $index is smaller than the negative length of the string, $insert is added to the beginning.

Reminder

Hi Developers, we almost covered 99.1% of Sass Tutorials with examples for quick and easy learning.

We are working to cover every Single Concept in Sass.

Please do google search for:

Join Our Channel

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.

Share this Page

Meet the Author