In-built method for easier adding separators in strings with large numbers. #61
InigoMonotoya
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Some day i wanted to improve readability of my score counter, by adding dots after thousands, millions, etc., to look like this: "Score: 12.345.678", instead of: "Score: 12345678". But, turns out, that there is no simple way of doing this in Godot. So i wrote a function to do that, and i thought that maybe someone more capable than me can make it into a built-in method, to make it easier for everyone. Without further adue, here it is:
For loop adds characters from the end of original string and every third run (assuming interval == 3) puts a separator in beginning. After loop finishes, function runs the if statement, to avoid profanities like ".123.456.789". I imagine calling this method would look like this:
I don't know if anybody needs this and frankly, my dear, i don't give a damn, so i'm happy to just leave it here, as is.
Beta Was this translation helpful? Give feedback.
All reactions