This built-in module is available from the URL sass:string
.
index($string, $substring)
This function is also available as a global function named str-index()
.
insert($string, $insert, $index)
This function is also available as a global function named str-insert()
.
length($string)
This function is also available as a global function named str-length()
.
quote($string)
This function is also available as a global function named quote()
.
slice($string, $start-at, $end-at: -1)
This function is also available as a global function named str-slice()
.
split($string, $separator, $limit: null)
-
If
$string
is not a string, throw an error. -
If
$separator
is not a string, throw an error. -
If
$limit
is a value other than an integer ornull
, throw an error. -
If
$limit
is less than 1, throw an error. -
If
$string
is an empty string, return a list with$string
as the only item. -
Let
split-list
be an empty list. -
If
$limit
isnull
, set$limit
to the value of callingstring.length($string)
. -
Let
split-counter
equal 0. -
While
split-counter <= $limit
andstring.length($string) > 0
:-
If
split-counter == $limit
:-
Append
$string
tosplit-list
. -
Set
$string
to an empty string.
-
-
Otherwise:
-
If
$separator
is an empty string:-
Let
code-point
be the value of callingstring.slice($string, 1, 1)
. -
Append
code-point
tosplit-list
. -
Set
$string
tostring.slice($string, 2)
. -
Increase
split-counter
by 1.
-
-
Otherwise:
-
Let
index
be the result of callingstring.index($string, $separator)
. -
If
index
isnull
, append$string
tosplit-list
and set$string
to an empty string. -
Otherwise:
-
Let
current-substring
be the result of callingstring.slice($string, 1, index - 1)
. -
Append
current-substring
tosplit-list
. -
Set
$string
tostring.slice($string, index + string.length($separator))
. -
Increase
split-counter
by 1.
-
-
-
-
-
Return
split-list
as a bracketed, comma-separated list.
to-lower-case($string)
This function is also available as a global function named to-lower-case()
.
to-upper-case($string)
This function is also available as a global function named to-upper-case()
.
unique-id()
This function is also available as a global function named unique-id()
.
unquote($string)
This function is also available as a global function named unquote()
.