ends-with ()
Determines whether a string ends with the characters of a specified substring, returning true or false as appropriate.
Parameters
$string
- The source string in which the substring is to be searched for.
- Type
String
$substring
- The characters to be searched for at the end of the source string.
- Type
String
$end-at
- The index at which to end the search. A negative index can be used, indicating an offset from the end of the source string.
- Type
Number
- Default
-1
Return Value
Boolean
true
if the given characters are found at the end of the string; otherwise,false
.
Example
@use '@sass-fairy/string';
$todo: 'Friday Dinner with Diane.';
@debug string.ends-with($todo, 'ane.');
// true
@debug string.ends-with($todo, 'Fri', 3);
// true
@debug string.ends-with($todo, 'with', -8);
// true