+1 vote

For example: display 10000 as 10,000 etc

I couldn't find the answer in the docs or in this forum

in Engine by (13 points)

1 Answer

0 votes

I don't think it has.

But it can easily be solved with something simple like this, but better programmed.

func _ready():

    print(get_currency(50000))


static func get_currency(number):

    # Place the decimal separator
    var txt_numb = "%.2f" % number

    # Place the thousands separator
    for idx in range(txt_numb.find(".") - 3, 0, -3):
        txt_numb = txt_numb.insert(idx, ",")
    return(txt_numb)

It will print 50,000.00

by (106 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.