How Do I separate Numbers in a Calculator manner like so


#1

If a user types in 4500000000_ Stars, I want the numbers to be easy to Count, so they should appear like so 4 500 000 000_Stars. User : 2212320000000_ Stars Interface : User : 2 212 320 000 000_ Stars.

Thank you for reading.


#2

Does the user input the “_Starts” too? Or just the number?


#3

Just the Numbers MrMen. Thanks :slightly_smiling_face:


#4

You can create an extension with a “String Expression” that takes an argument called “number” of type “Number” and has a single javascript block:

eventsFunctionContext.returnValue = eventsFunctionContext.getArgument("number").toLocaleString()

#5

Can please give more examples to make it easier to understand.


#6

Try this for size :

It assumes the input number is stored in the scene variable _inputValue.

_displayValue is the result, spaced out every 3 characters from the right.


#7

Thanks MrMen

I’ll notify you when it’s working.


#8

It isn’t working for me:sweat::sweat:, is there another solution out there?.


#9

It works, I’ve tested it myself. Screen shot what you’ve got, and we’ll see if you’ve gone wrong somewhere.


#10

Thanks a lot, MrMen, what gave a bit of trouble was that I am using a late version of Gdevelop and your example is of an old version But it’s now working perfectly all thanks to you :handshake:


#11

Nope, that can’t have been it, because I’m using the latest (5.0.0 beta 1.1.0)

But anyway, it’s good you got it working, and best of luck with the app :smile: