str_slice

str_slice($string, $start-at, $end-at:-1)

Extracts a substring from $string. The substring will begin at index $start-at and ends at index $end-at.

Note that unlike some languages, the first character in a Sass string is number 1, the second number 2, and so forth.

Examples:

str-slice("abcd", 2, 3)   => "bc"
str-slice("abcd", 2)      => "bcd"
str-slice("abcd", -3, -2) => "bc"
str-slice("abcd", 2, -2)  => "bc"

Returns The substring. This will be quoted if and only if $string was quoted

Parameters:

  • $start-at (Number) The index of the first character of the substring. If this is negative, it counts from the end of $string
  • $end-before (Number) The index of the last character of the substring. If this is negative, it counts from the end of $string. Defaults to -1

Returns:

  • (String) The substring. This will be quoted if and only if $string was quoted

Raises:

  • (ArgumentError) if any parameter is the wrong type
doc_Sass
2016-11-11 13:09:26
Comments
Leave a Comment

Please login to continue.