cancel
Showing results for 
Search instead for 
Did you mean: 

Javascript toLocaleString

Muts
New Contributor

Javascript toLocaleString

I have:-

var numb = 1234.5678;

var frmt = numb.toLocaleString('de-DE', { style: 'currency', currency: 'EUR',minimumFractionDigits: 2, maximumFractionDigits: 2});

 

I expect frmt to be 1.234,57 €

 

But frmt is "1234.5678" - just a string version of the float.  Does TC support toLocaleString?

1 REPLY 1
tristaanogre
Community Hero

Re: Javascript toLocaleString

From the help (found at  https://support.smartbear.com/testcomplete/docs/scripting/specifics/javascript.html )

 

 

Unsupported Features

 

toLocaleString is part of that Internationalization API... therefore, not supported.

 

If you need to convert to a currency, you can use aqConvert.CurrencyToStr... I know that it's a number, but because this is not a strongly typed language, you can still pass your number to that converstion routine and it will convert it to a string formatted as a currency... you can also use aqConvert.CurrencyToFormatStr... now, it will still use your default location in your environment to determine the separators and such...  To that end, you'll need to have the Locale set using SetLocaleInfo.  


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors