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
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The first one works if you put it like this:
s=s.substring(0,dot);
Thanks!
s=s.substring(0,dot);
Thanks!
s = s.split("\.")[0];