Is it the same text?
- O(1) · Trivial
- Free
- Python
- JavaScript
- strings
- booleans
Problem
Two people typed the same thing, but one used capitals and the other one left an extra space at the end. Write a function that takes two texts and returns true if they are the same, ignoring upper and lower case and the spaces on the sides: "Hello" and " hello " are the same.
Spaces in the middle do count, and two empty texts are the same.
Examples
"Hello", " hello " → true
"cat", "dog" → false
" YES ", "yes" → true
A space in the middle
"two words", "twowords" → false
Besides these, the challenge has hidden tests that are revealed when you submit your solution.
You start with this
Python
def same_text(one, other):
passJavaScript
function sameText(one, other) {
}Solve this challenge
It opens in your browser, with the editor and the tests. It is free and you do not need an account to start.