ends_with
TABLE OF CONTENTS
Check if a string ends with a given suffix
Definition
boolean ends_with(string $subject, string $suffix)
Checks if $subject ends with $suffix.
Parameters
string $subject
The string to check the ending of.
string $suffix
The suffix for which the string is checked.
Returns
boolean
true if $subject ends with $suffix, otherwise false.
Examples
Transformation
{
a: ends_with('Hello, world', 'world'),
b: ends_with('Hello, world', 'hello'),
c: ends_with('Hello, world', 'd'),
d: ends_with('Hello, world', ''),
e: ends_with('Hello, world',`null`) // Error
}Result
{
"a": true,
"b": false,
"c": true,
"d": true
}Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article