Skip to main content
Dirlo
Inspiring
December 6, 2018
Answered

Big number in a text caption

  • December 6, 2018
  • 1 reply
  • 514 views

...

Hello Captivaters !...

I'm starting to work with big numbers... I made a D&D slide in which I can put 1 000, 100, 10 or 1 blocks in a specific area.

And I have a variable which counts the number of cubes.

(Inspired by Paul Wilson's video : Drag and Drop Counting Game for Adobe Captivate 2019 - YouTube )

You can see this here :

Everything seems to work fine but my problem is :

=> I want my number to be 3 110 (with a space after the 3 first digit) instead of 3110.

As I will want to work with millions, billions... this will be more and more difficult to read for my learners without the spaces...

So I need you help !!...

Many thanks in advance !...

...

    This topic has been closed for replies.
    Correct answer Lilybiri

    Il vous faudra du JavaScript.

    There is a function 'toLocaleString()' which you could use, but not sure it is supported by all browsers. Moreover it will take over the way numbers are displayed in your country. That is not always with a space, here we are using a point, in USA they are using a comma.....

    1 reply

    Lilybiri
    LilybiriCorrect answer
    Legend
    December 6, 2018

    Il vous faudra du JavaScript.

    There is a function 'toLocaleString()' which you could use, but not sure it is supported by all browsers. Moreover it will take over the way numbers are displayed in your country. That is not always with a space, here we are using a point, in USA they are using a comma.....

    Dirlo
    DirloAuthor
    Inspiring
    December 6, 2018

    ...

    Thanks Lily !

    But I don't know how to use this 'toLocaleString()'...

    As my variable is called v_Total_01

    I try (in a javascript window) this code :

    var nombre = v_Total_01;

    console.log(nombre.toLocaleString());

    (I tried also with ""... with a c after the name...)

    but without any success so far...

    (As usual in fact everytime I tried to use javascript in captivate... )

    ...

    Dirlo
    DirloAuthor
    Inspiring
    December 6, 2018

    ...

    Finally !...

    Javascript code :

    var nombre = v_Total_01.toLocaleString("fr-FR");

    And I show nombre in the Text Caption, instead of the variable v_Total_01...

    It was so simple that I spent my all afternoon on this !!!...

    ...