Skip navigation
Currently Being Moderated

How to get PMReal value from PMString considering the OS format settings of decimal character?

Jul 17, 2012 5:19 AM

Tags: #locale #decimal_notation #pmstring_to_pmreal #os_format_settings

Hi All,


I am working on a plugin and have got stuck in a problem.


The notation for the decimal character on my machine is set to ',' instead of the usual '.' Now, I have a number in PMString having comma as decimal character say, 34,123 and I need to convert this to PMReal.

I was using GetAsDouble() method of PMString but this method doesn't detect comma as decimal separator and gives 34 as the number.


Can anyone tell me how can I convert PMString to PMReal with the representation that considers the OS settings for representing the decimal.

  • Currently Being Moderated
    Jul 17, 2012 12:14 PM   in reply to Daves61

    Yesterday I found out the hard way that (beyond measurement units) I never use localized PMReal, so finding WidgetUtils took a while and I still had no good answer to your sub-question.


    Again, is there any widget that exposes a similar behaviour? Then you could create an instance of that boss and use its ITextValue. That overkill is probably not the best solution, though.


    Another direction, short from platform specific code, could be boost. nd_parsing.html


    And if you read that page, you'll also eventually run across a reference to "ICU". Yup, the SDK has a very promising folder "external/icu". I think we're coming closer - happy digging.



    Mark as:
  • Currently Being Moderated
    Jul 17, 2012 11:34 PM   in reply to Dirk Becker



    I am missing some thing. Would be a case of just change the ',' to a full point and convert in the usual way.



    Mark as:
  • Currently Being Moderated
    Jul 18, 2012 5:56 AM   in reply to Pickory

    Pickory wrote:


    I am missing some thing. Would be a case of just change the ',' to a full point and convert in the usual way.


    Conversion between internal values and strings (either for display or entered by the user) should follow the local setting for decimal separator (and, if necessary, digit grouping). It's up to the OS to provide this information.


    As a matter of fact, here in Holland some of our computers are set to the Dutch system -- comma as decimal separator, period as digit group separator -- but it depends on the software if that is recognized for input or output. I don't think Adobe's software as a whole conforms to this, so it's always a guessing game.

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points