+1 vote

For example: display 10000 as 10,000 etc

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

asked Jul 9 in Engine by OrdinaryMan (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

answered Jul 11 by cgeadas (96 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.