# isolating a number from its place value

Get help using Construct 2

### » Wed Mar 06, 2013 10:45 pm

i am not sure about my translation [number value?] but what i mean is for example picking 6 from 657, not 600.

i hope my explanation is clear.

B
14
S
4
G
3
Posts: 101
Reputation: 3,499

### » Wed Mar 06, 2013 11:21 pm

B
18
S
5
G
4
Posts: 568
Reputation: 5,079

### » Wed Mar 06, 2013 11:52 pm

@California , Why ask that ?

To pick 6 from 657
it just takes some math ...

floor(657/100)

Here we go

You can remplace 657 by any other 3 numbers number !
B
35
S
16
G
16
Posts: 2,223
Reputation: 16,591

### » Thu Mar 07, 2013 1:07 am

to know if something got lost in translation and help him in his own language.
B
18
S
5
G
4
Posts: 568
Reputation: 5,079

### » Thu Mar 07, 2013 9:30 am

thanks @whiteclaws :)
B
14
S
4
G
3
Posts: 101
Reputation: 3,499

### » Thu Mar 07, 2013 9:38 am

but does it solve the problem for 5 in 657, or for 7?

how can i eliminate tens or hundreds?
B
14
S
4
G
3
Posts: 101
Reputation: 3,499

### » Thu Mar 07, 2013 10:05 am

by subtracting them? 657 - 600 = 57, 657 - 650 = 7

You could also put the numbers into a string, str(657) then pick the letter based on its position, and convert it back into a number int(mid(1,1)) would return 6.Ethan2013-03-07 10:08:58
B
37
S
19
G
19
Posts: 617
Reputation: 10,739

### » Thu Mar 07, 2013 10:13 am

the numbers will not be predetermined. so, for substraction i think i must add another floor function etc.

or use your string solution :)

thanks @ethan.
B
14
S
4
G
3
Posts: 101
Reputation: 3,499

### » Thu Mar 07, 2013 11:01 am

i've taken @ethan's advice and used zeropad expression too and this one below solved my problem:

i used "left" and "mid" too of course.
B
14
S
4
G
3
Posts: 101
Reputation: 3,499

### » 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

Next