How to parse locale specific number strings

Posted on 2008-11-11
Last Modified: 2013-12-14
I have an application that needs to run in 20 different locales. One part of the app contains a dialog with a control where a number is entered. The number format can be n.n or n,n dependding on the locale.

How do I check the number string to insure it conforms to the locale, and how do I then convert it to a number?
Question by:JMandler
    1 Comment
    LVL 86

    Accepted Solution

    Call 'GetLocaleInfo()' and query for 'LOCALE_SDECIMAL' to get the decimal separator. See also ("Localized numeric editbox") for a complete example, you probably will be able to re-use a lot of that code.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    Suggested Solutions

    Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
    If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
    The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
    THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now