325 views
in System Integration by
Hi,

I'm developing an application which will run in different languages with different regional settings. When I modify the system locale to use a comma "," for the decimal separator I can see that when creating strings from numbers the application is correctly displaying them, however when I get an input from the user through my application using a virtual keyboard and run the string.parse_float function It will use the default regional settings. Is there a way to specify the locale for this function? I suppose a workaround would be to develop a device driver to convert the string to a number and feed that back to the application but perhaps there is a way to override the EwStringParseFloat function?

Thanks for your help.
by
Just realised I can also do the overriding directly in EW by using my own parse_float function which I specify the decimal separator.

1 Answer

0 votes
by

Hello ialden,

the functionality to format numbers, date, time, as well to parse numbers don't depend on any particular local settings. Embedded Wizard, in its actual version provides only common functionality to support these operation out of the box. As you deduced, language specific formatting aspects need to be handled individually e.g. by implementing your own parse_float() method.

It does not necesarily mean that you have to implement all the affected functions from scratch. You could, for example, limit your implementation to replace the comma sign by a period and then pass the string to the original parse_float() function:

var string s = "123,456";

// Search in the original string for the , comma sign
var int32  i = s.find( ',', 0 );

// If found, replace it by period sign
if ( i >= 0 )
  s[i] = '.';

// Parse the string as usual
var float f = s.parse_float( 0.0 );

trace f;

Best regards

Paul Banach

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...