isolating a number from its place value

Get help using Construct 2

Post » Thu Mar 07, 2013 11:10 am

Why don't you convert the number to string and use mid(Text, Index, Length) to pull the current value.

Example:
Number = 657

mid(str(Number), 0, 1) would give you 6
mid(str(Number), 1, 1) would give you 5
mid(str(Number), 2, 1) would give you 7
B
24
S
11
G
5
Posts: 140
Reputation: 5,004

Post » Thu Mar 07, 2013 11:19 am

you are right. i didn't know that. but zeropad is still necessary i think.ebrar2013-03-07 11:28:19
B
14
S
4
G
3
Posts: 101
Reputation: 3,499

Post » Thu Mar 07, 2013 1:26 pm

Think a bit , what would give us 600 ?
(Floor(657/100))*100

Then you just do

Floor((657-600)/10)

And you get the 5

Then you do

657-600-5*10=7

And you get
6,5,7

Math solves everything , just think a bit !
B
34
S
16
G
16
Posts: 2,222
Reputation: 16,564

Post » Thu Mar 07, 2013 1:54 pm

@whiteclaws

Yes you are right too. Maybe thinking of simpler solutions is better than searching a magic wand (like an expression which can give me exactly what i want, i couldn't find one anyway :) ).

thanks all of you again.
B
14
S
4
G
3
Posts: 101
Reputation: 3,499

Previous

Return to How do I....?

Who is online

Users browsing this forum: bluemonkey, MarkThomas and 21 guests