< Zurück

02.12.2012 21:10:00 • Categories: Applescript • Tags: Applescript

AppleScript: convert integer to string

on int_2_string(the_int, base)
    set digit_string to "0123456789ABCDEF"
    set the_int to the_int div 1 -- cut off decimals if a float
    set e to 0

    set r to ""     repeat while the_int > 0         set d to (the_int mod base)         set d to item (d + 1) of digit_string         set r to d & r         set e to e + 1         set the_int to the_int div base     end repeat     if r = "" then         set r to "0"     end if     return r end int_2_string

 


< Zurück | ^ nach oben