Understanding how many digits within a number

    Aug 24 2013 | 12:41 pm
    I am trying to work out how large a number is determined by how many indivdual numbers are in a numbers.
    For example, I know that 100 has three digits. And 10 has two digits. I am having difficulty understanding how to receive this information to bang further information

    • Aug 24 2013 | 1:23 pm
      try [expr int(log10($i1))+1]
      basically log10 converted to integer, and then + 1.
      ...there are probably cheaper ways of doing it, but hey.
    • Aug 24 2013 | 2:58 pm
      thank you
    • Aug 25 2013 | 2:54 pm
      [itoa] and then some list manipulation is probably a tad cheaper, CPU-wise, but the log() formula works.
      Back in the days when I was using a BASIC interpreter on a Commodore C64, it actually made a difference, but that was a long time ago.