finishing the code

This commit is contained in:
AJ Meireles
2023-09-05 20:36:18 -03:00
parent cc6c5bf199
commit 3927177b23
8 changed files with 38 additions and 9 deletions

View File

@ -51,7 +51,7 @@ final class Str
return true;
}
return substr($target, -$length) === $search;
return $search === substr($target, -$length);
}
/**
@ -92,4 +92,12 @@ final class Str
{
return $search === '' ? $subject : array_reverse(explode($search, $subject, 2))[0];
}
/**
* Creates a describe block as `$right` → `$left` format.
*/
public static function describe(string $right, string $left): string
{
return sprintf('`%s` → %s', $right, $left);
}
}