Skip navigation
Currently Being Moderated

Convert PMReal to string taking into consideration the OS format settings

Jul 15, 2012 11:21 PM

Tags: #string #locale #pmreal #decimal_notation

Hi All,

 

I have come across a problem in which i would like the esteemed members of this community to spare a thought.

 

I have a number in a PMReal and i have to display it on a text box of a dialog created by my plugin. The notation for the decimal character on my machine is set to ',' instead of the usual '.'

 

This change is refelected all over Indesign in the numbers displayed but the number that i have in the PMReal is displayed with a '.' in it, i.e it is not respecting the OS settings.

 

I have used AppendNumber of PMString to convert PMReal to a string also used "stringnumeric::ToString" but nothing happens the number is displayed with a '.'.

 

So could anyone guide me to a way wherin i could convert a PMReal to a string with the representation that considers the OS settings for representing the decimal.

 

Manan Joshi

 

  - Efficient InDesign Solutions -

MetaDesign Solutions

http://metadesignsolutions.com/services/indesign-development.php

 
Replies
  • Currently Being Moderated
    Jul 16, 2012 1:10 PM   in reply to Manan Joshi

    You could use ITextValue of a RealEditBoxWidget.

    Besides there are some routines in IWidgetUtils, e.g. FormatUserDecimal().

     

    If the value is a measurement, search for IUnitOfMeasure ...

     

    Dirk

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 16, 2012 11:44 PM   in reply to Dirk Becker

    Hi All,

     

    I am also stuck in a similar situation.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. That means I need a reverse of FormatUserDecimal() function.

     
    |
    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