Code Lab

Modo entrevista. Temporizador de 5 min, sin pistas y sin autocompletado

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.

Ejemplos

onlyLetters('a1b$c d!')

Devuelve 'abcd'

onlyLetters('Test123Case')

Devuelve 'TestCase'

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

Devuelve 'QA'

Cyrillic letters go too.

Preguntada en Paytm · Fuente

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

Las pruebas ocultas se ejecutan al enviar