Sass str-slice() Function

Last Updated:

Sass str-slice() Function

The str-slice() function returns the slice of a string starting at the specified index and ending at the specified index.

Example

SASS TO CSS CONVERTER
//Check your console @debug str-slice("sans-serif", 5); // "-serif" @debug str-slice("sans-serif", 1, 4); // "sans" @debug str-slice("sans-serif", 1, -2); // "sans-seri"

Syntax

str-slice($string, $start-at, $end-at)

Parameter Value

ValueTypeExplanation
$string Required A string
$start-at Required A number
$end-at Optional A number. Default value is -1.

Return Value

ValueExplanation
string Returns the slice of $string starting at index $start-at and ending at index $end-at (both inclusive).

Share this Page

Meet the Author