Jump to content

GetDigit(Num, Dig) udf


 Share

Recommended Posts

I ain't got nuttin betta ta do, so I just made this peice a crap here:

It retrieves the digit of a numby poo, in a non-string like manner.

func GetDigit($num, $dig)

$numpy = $num

for $i = 1 to $dig
$mumpy = mod($numpy, 10)
$numpy = int($numpy / 10)

next

return $mumpy[/indent]

endfunc

func DigitCount($num)

return int(log($num)) + 1

endfunc

I didn't test it so I don't know if it works or not, you check. I wrote this write into here off the top of my slow brain.

I am pretty sure it works, because well, I wrote it.

Edit: Another thing, it counts from the right. So 1 is the first digit on the right. 2 is the seccond digit from the right.

Forgive me of mistakes however, I haven't used AutoIt in awhile. I been to wrapped up in C++.

Edited by myredeemerlives
Link to comment
Share on other sites

I ain't got nuttin betta ta do, so I just made this peice a crap here:

It retrieves the digit of a numby poo, in a non-string like manner.

func GetDigit($num, $dig)

$numpy = $num

for $i = 1 to $dig
$mumpy = mod($numpy, 10)
$numpy = int($numpy / 10)

next

return $mumpy[/indent]

endfunc

func DigitCount($num)

return int(log($num)) + 1

endfunc

I didn't test it so I don't know if it works or not, you check. I wrote this write into here off the top of my slow brain.

I am pretty sure it works, because well, I wrote it.

Edit: Another thing, it counts from the right. So 1 is the first digit on the right. 2 is the seccond digit from the right.

Forgive me of mistakes however, I haven't used AutoIt in awhile. I been to wrapped up in C++.

Its the best code ever right? ;)
Link to comment
Share on other sites

It got lumpy at this line, so I put a crumpy(;) before the part that was bumpy, and then it was all humpy dory...

return $mumpy;[/indent]
Edited by jefhal
...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...