Forum Discussion

smskrishna's avatar
smskrishna
Occasional Contributor
15 years ago

String to float conversion problem in German OS



Hi,



As part of my test case ,my script reads a value (eg: 123.45) from textbox/editbox and I am musing StrToFloat conversion. It runs fine in my machine (OS Windows XP ,Language settings English US) , but when my customer runs it at his end it fails due to chenge in the OS.

My customer uses Windows XP with German settings where decimal separator is ","  (comma), but it is "."(dot) in my machine. Due to this error msg is thrown by Tetcomplete something like 'invalid float '.  We are using Testcomplete 6.5, C# is used for scripting . Is there any specific way to handle this in Testcomplete.




  • Hi,


    If you use Utilities.StrToFloat, it takes decimal separator from Utilities.DecimalSeparator.


    By default its taken from OS settings, but you can redefine it when you need before converting the string.


    Hope it will help you.


  • TestComplete help says about DecimalSeparator that:

    This property is obsolete and supported for backward compatibility only. The
    value of this property is used by obsolete methods of the Utilities object. To process float numbers, use
    the methods of the aqString
    object.




    How should this be handled with the aqString object? I can figure out a couple of workarounds, byt I would like to know which is the official approach.