Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Alternative to toLocaleString() in ExtendScript?

Contributor ,
Aug 17, 2016 Aug 17, 2016

As far as I can tell and after many attempts, this method doesn't work in ES. Does anyone know of an alternative for automatically adding commas to large numbers?

TOPICS
Scripting
752
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 17, 2016 Aug 17, 2016
LATEST

for what it's worth, this is my current, hacky workaround:

var data = {

  number: 12345

}

num = data.number.toString();

if (num.length > 3){

  data.number = num.substring(0, num.length-3) + "," + num.substring(num.length-3);

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines