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.
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.
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.
Yes Jongware you are correct. The problem is that if I replace comma with a period, though it would be solved for now but in other languages, there can be some other character being used as decimal character.
So, I was looking for some perfect solution.