Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

231
Vistas
How to remove the last empty keys in a string

I have a string that looks like this:

"a               "

As you can see there is only one character that is not empty " ". How do I remove the last charaters of the string so only the valid one(s) will remain:

"a"

This can also be considered in cases where the first characters are empty:

"         a"

I cannot simply remove each empty key as they can be part of a more complex sentence like this:

"I love Js            "
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

In order to be able to remove easily the trailing spaces I suggest that you use the trim() method.

a '.trim() // return 'a'

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda