10-18-2021 06:59 AM
Hi,
I'm writing something to help my daughter with maths and came across a little problem which I solved, but wondered if there was a neater way of doing it? More out of interest than anything.
Essentially I have a two digit number and want to extract what the two digits are to be able to do something with them. So for example if I had the number 59, the first digit would be 5 and the second would be 9.
The way I have done it is to convert it to a string and then split the string and then convert it back to a number again.
Hardly computationally intensive but just seems inefficient. Is there a better/ neater/ shorter way of doing it?
Thanks
Andrew
Solved! Go to Solution.
10-18-2021 07:17 AM - edited 10-18-2021 07:23 AM
For a two digit number I would use 'Quotient & Remainder' function and divide by ten.
10-18-2021 07:29 AM - edited 10-18-2021 07:33 AM
This is my implementation for a general one, seems to work for digits before decimal and after:
Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.
10-19-2021 02:50 AM
Great, thank you both! Have given Kudos to both, but selected FireFist-Redhaw
Thanks again
Andy