Godot: How To Add Commas On Floats Or Integers In GDScript?

How To Add Commas On Floats Or Integers In GDScript?

As of Godot version 3.2.3, GDScript does not have a function that can add commas to floats or integers. So, you need to create a helper function that can process the value and return it as a string with commas.

Below is a code snippet of the method that I use to add commas on floats and integers. I decided to share the function that I use on my projects, with the hope that this will help others as well.


Function For Integers



Function For Floats



-End


Social Media & Contact

Croben Facebook Page
Croben Twitter Page
Croben Youtube Page
Croben Instagram Page
Croben Contact Page

Comments

  1. Good stuff, cheers.

    I also added in
    if (value < 10000):
    return str_value

    So it won't add marks to four digit numbers.

    ReplyDelete
  2. You can depend on incredible graphics and you should not|you shouldn't} expertise any troubles related to enjoying in} on the smaller pill or telephone screen. JackpotCity provides you with yet another likelihood to 더킹카지노 win big by enjoying in} your favorite progressive slots. Don't miss to strive King Cashalot, Treasure Nile, Major Millions, Cash Splash, Mega Moolah, Break da Bank Again, Terminator, Tunzamunni.

    ReplyDelete

Post a Comment