Skip to content
Advertisement

How to trim the characters in the string?

I have a list.

JavaScript

I want to trim the strings in the list to remove the characters including . sign and the numbers.

Expected output:

JavaScript

Advertisement

Answer

You can use regex with pattern as r'.d+'. This will literally match . followed by one ore more digits.

JavaScript
Advertisement