str_index

str_index($string, $substring)

Returns the index of the first occurrence of $substring in $string. If there is no such occurrence, returns null.

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

Examples:

str-index(abcd, a)  => 1
str-index(abcd, ab) => 1
str-index(abcd, X)  => null
str-index(abcd, c)  => 3

Parameters:

  • $string (String)
  • $substring (String)

Returns:

  • (Number, Null)

Raises:

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

Please login to continue.