Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: Gav (HeyBud) on June 11, 2014, 06:51:39 AM
-
Hello,
I need help with breaking up a 3 digit int into 3 separate integers.
For example: myInt = 150
For my purpose, I need to get an int for each place value. So from 150 i'd like to get ints for 1 and 5 and 0.
Would this be possible at all with playmaker?
:-\
Thanks
-
Hi,
yes totally, the easiest way, is to convert your int into a string, then take each character, and back into an int.
use "get substring" to get to a particular character, and use "iterate" ( use the ecosystem (https://hutonggames.fogbugz.com/default.asp?W1181) to get this action) to go through each chars in turn to process them.
you may want also to use ArrayMaker (https://hutonggames.fogbugz.com/default.asp?W715) to store your results, especially if you don't know the number of digits ( meaning you can't hardcode three values for example).
Bye,
Jean
-
Jean,
I just wanted to let you know this solution worked for me.
Thank you!
-
Hi,
Thanks.
Bye,
Jean