0 votes

Can someone help me fix this code? The issue is the comma in digits.

enter image description here

efunc comma(number):
var string = str(number)
var mod = string.length() % 3
var res = ""
for i in range(0, string.length()):
    if i != 0 && i % 3 == mod:
        res += ","
    res += string[i]
return res
pass

func moneysuffix(money):
var suffix = [" ", "k", "m", "b", "t"]
var x = 0
while money >= 1000:
money /= 1000
x += 1
if x == suffix.size() - 1:
break
var suffixed
money = str(money) + suffix[x]
return suffixed_money
pass

func process(delta):
MoneyLabel.text = "$" + str(comma(money
suffix(money)))

in Engine by (21 points)
edited by

Please log in or register to answer this question.

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 Frequently asked questions and 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 [email protected] with your username.