Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

239
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!