Skip to main content

replace ()

Returns a list with all occurrences of the given value replaced by the specified replacement.

Parameters

$list
The list from which the value is to be replaced.
Type
List
$value
The value to be replace by the replacement.
Type
*
$replacement
The value that replaces the specified value.
Type
*
$separator
The type of separator to be used by the copied list.
Type
space | comma | slash | auto
Default
auto

Return Value

List
A list with all occurrences of the value replaced by a replacement.

Example

@use '@sass-fairy/list';

$list: 'ant', 'bison', 'camel', 'bison', 'duck', 'elephant';

@debug list.replace($list, 'bison', 'chicken');
// 'ant', 'chicken', 'camel', 'chicken', 'duck', 'elephant'