Communities for your favorite technologies. Explore all Collectives
Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
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.