Check if String Ending Matches Second String

Published by Николай in

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

Examples

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

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

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

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

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

Notes

All test cases are valid one word strings.

Watch a quick demo on how Edabit works.