#extract the hundreds and the tens from an integer variable

1 messages · Page 1 of 1 (latest)

jovial moss
#

example, my arg-1 is 156
i want to save 100 as {_hundred} and 56 as {tens}, how do i do that?

delicate crater
#

math probably

#

probably something like floor({_num}/(10^n))

#

then you just cycle through n values from greatest to least

#

or, you can stringify it and then get each character
(but then you'd have to parse as a number again if you plan on using them as numbers)

jovial moss
#

docs says that floor will return the nearest integer

#

something like this?

set {_num} to arg-2
set {_int} to floor({_num}/(10^n))
send "{_int}"

#

no idea how to cycle through n values tho

delicate crater