Jump to content




Getting number of digits


  • You cannot reply to this topic
4 replies to this topic

#1 Doyle3694

  • Members
  • 815 posts

Posted 23 October 2012 - 03:39 PM

Hey guys, just wondering, is there a way to get the number of digits in a number, so for example, I enter 5678 and use it in this function so it will return 4. short of, ofcourse, writing and getting CursorPos

#2 faubiguy

  • Members
  • 213 posts

Posted 23 October 2012 - 04:14 PM

You can use string.len on numbers.
string.len(5678) -- Returns 4


#3 PixelToast

  • Signature Abuser
  • 2,265 posts
  • Location3232235883

Posted 23 October 2012 - 04:16 PM

or just use the # operator
val=5678
return #val


#4 faubiguy

  • Members
  • 213 posts

Posted 23 October 2012 - 04:21 PM

View PostPixelToast, on 23 October 2012 - 04:16 PM, said:

or just use the # operator
val=5678
return #val

Doesn't work. I just tested it. Attempt to get length of number

#5 Doyle3694

  • Members
  • 815 posts

Posted 23 October 2012 - 04:25 PM

OK, thanks





3 user(s) are reading this topic

0 members, 3 guests, 0 anonymous users