Link to home
Start Free TrialLog in
Avatar of larsan
larsan

asked on

To trim a string value

Hi!

I have a string value that can look somewhat like this:
"410.13456"
"1024.7940"
or something like that.

What I want to do is, if there's a "." in the string, remove everything behind it. Ie. "410.13456" will become "410".

How do I do this the simplest way possible.

Regards,
David
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
or maybe:

s = s.split("\.")[0];
Avatar of larsan
larsan

ASKER

The first one works if you put it like this:

s=s.substring(0,dot);

Thanks!