I need help im making a key generator and a lock for the keys and i need to split the #s they type in into seperate numbers
any help would be appriciated
thank you!
What do the numbers look like and how are they stored?
Edit:
If they’re stored in a list, and you know the largest number possible in that list, you could do something like this:
set mynumbers to {1, 22, 333}
set max to 999 -- largest number possible in mynumbers
set charcount to count of (max as text)
set chars to ""
repeat charcount times
set chars to chars & "0"
end repeat
set mytext to ""
repeat with n in mynumbers
set mytext to mytext & (text -charcount thru -1 of (chars & (n as text)))
end repeat
But then you’d need to retain the number of characters per number for converting back. Another possibility is to use a delimiter, but that makes deciphering a little easier.
If you’re dealing with a number string (entered in a dialog, perhaps) then this?
set tKey to "37645"
set Nums to text items of tKey --> {"3", "7", "6", "4", "5"}
or perhaps this?
set tKey to "37645"
set Nums to text items of tKey
repeat with N in Nums
set contents of N to N as integer
end repeat
Nums --> {3, 7, 6, 4, 5}
Its in string form but i solved it
ty for the help