Code Lab

Modo entrevista. Cronômetro de 5 min, sem dicas e sem autocompletar

Letters only

FácilStrings5 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.

Exemplos

onlyLetters('a1b$c d!')

Retorna 'abcd'

onlyLetters('Test123Case')

Retorna 'TestCase'

onlyLetters('Привет, QA!')

Retorna 'QA'

Cyrillic letters go too.

Cobrada em Paytm · Fonte

Carregando o editor...
  1. EntradaonlyLetters('a1b$c d!')
    Esperado'abcd'
  2. EntradaonlyLetters('Test123Case')
    Esperado'TestCase'
  3. EntradaonlyLetters('Привет, QA!')
    Esperado'QA'

Os testes ocultos rodam no envio