Check if String Ending Matches Second String

Published by Matt in

Create a function that takes two strings and returns true if the first string ends with the second string; otherwise return false.

Examples

check_ending("abc", "bc") ➞ true

check_ending("abc", "d") ➞ false

check_ending("samurai", "zi") ➞ false

check_ending("feminine", "nine") ➞ true

check_ending("convention", "tio") ➞ false

Notes

All test cases are valid one word strings.

Watch a quick demo on how Edabit works.