Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
I get a number format string from an input box like: 1,033.00 How can I convert it to 1033 by jquery/javascript? I have to use this converted number to add it with another number.
You can do a string replace numberString= numberString.replace ( /[^0-9]/g, '' );
numberString= numberString.replace ( /[^0-9]/g, '' );
To add it to another number you can use + operator to convert the numberString to a number value.
+
var numberString= numberString.replace ( /[^0-9]/g, '' ); var addition = +numberString + anotherNumber;
Add a comment
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.