Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Can I find how many digits are in a number value with string.len?

Asked by 5 years ago
Edited 5 years ago

So basically I am making a system that will do something like this, if you have 1,542 cash or something, it will show as 1.542 Thousand as what it says for your cash instead, so I am guessing I will need to check how many digits it is. Would string.len work?

0
local num = 12345; print(tostring(num):len()) Ziffixture 6913 — 5y
0
Do not use the len function. Use the length operator. #tostring(num) User#24403 69 — 5y
0
https://scriptinghelpers.org/questions/23724/how-do-i-make-a-miners-haven-leaderboard found this a few weeks back to help with the same sort of question you have. TimeOverseer18 1 — 5y
0
That was a terrible answer. User#25115 0 — 5y
View all comments (4 more)
0
You could use `tostring`, then replace the dot with `gsub`. `tostring(Num):gsub(',', '.')` TheeDeathCaster 2368 — 5y
1
@Phlegethon5778, it wasn't an answer, thus the reason it's a comment. TimeOverseer18 1 — 5y
0
I was referring to the answer for the linked question. I'm not stupid. User#25115 0 — 5y
0
Woah calm down guys. Anyway for the people who told me thanks! XX_Scripta 11 — 5y

Answer this question