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.
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.
http://www.boost.org/doc/libs/1_49_0/libs/locale/doc/html/formatting_a 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.
Dirk
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.
North America
Europe, Middle East and Africa
Asia Pacific