Letters only
EasyStrings5 min
Write a function onlyLetters(text) that keeps only the Latin letters a to z and A to Z in a string. Digits, spaces, punctuation and letters of other alphabets are removed. Letters keep their case.
Examples
onlyLetters('a1b$c d!')Returns 'abcd'
onlyLetters('Test123Case')Returns 'TestCase'
onlyLetters('Привет, QA!')Returns 'QA'
Asked at Paytm · Source
Loading the editor...
- Input
onlyLetters('a1b$c d!')Expected'abcd' - Input
onlyLetters('Test123Case')Expected'TestCase' - Input
onlyLetters('Привет, QA!')Expected'QA'
Hidden tests run on Submit