RahulKajave
asked on
Convert string to integer
Is there any C++ function which will convert wide char string to int. If wide char string is double "100.01" then function should return error. I can use isDigit and add own logic to validate this but wanted to check whether there is any in build function for the same. I am using VC++ on windows.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Yup. In both cases the constraint is 'non-numeric character', regardless of the localization.
Do you still have issues with this or have you just not thought of closing the question?
// What about localization?
You can write a function to replace the special characters(, with .) and then pass through stringstream to get the double/int value if needed as specified above by JKR.
You can write a function to replace the special characters(, with .) and then pass through stringstream to get the double/int value if needed as specified above by JKR.
Um, integers won't have a double-type separator such as a comma or a semicolon in the 1st place ;o)
ASKER