Scala Programming: Check whether a given string ends with the contents of another string
Write a Scala program to check whether a given string ends with the contents of another string.
Sample Solution:
Scala Code:
Sample Output:
"Python Exercises" ends with "se"? false "Python Exercise" ends with "se"? true
Scala Code Editor :
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous: Write a Scala program to create a new String object with the contents of a character array.
Next: Write a Scala program to check whether two String objects contain the same data.
What is the difficulty level of this exercise?
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics