# How do I get a certain digit from a number?

Get help using Construct 2

### » Thu Feb 11, 2016 11:53 pm

How can I get a certain digit, say a, from a number, say b? I used to program often in python, and in python there's expression, "string"[1], which returns the first letter of the string. However, I can't find that in Construct 2.
B
10
S
2
Posts: 20
Reputation: 622

### » Fri Feb 12, 2016 12:06 am

to get W in Woodland use action
--------------------------------> left(Woodland,1)

say as "string"[1]
variable = "Woodland"

variable[1] python

--------------------------> system set A to left(variable,1) construct 2
B
54
S
16
G
2
Posts: 371
Reputation: 4,771

### » Fri Feb 12, 2016 2:02 am

I'm not sure what I'm doing wrong, but for some reason I'm getting absurd numbers when I run this code:

What the code should do is get rid of the number on the far right, help please?
B
10
S
2
Posts: 20
Reputation: 622

### » Fri Feb 12, 2016 2:38 am

Substract

12345-5=12340
12340-0=12340
12340-0=12340
etc

Set

12345
1234
123
etc
B
67
S
24
G
7
Posts: 1,519
Reputation: 11,094

### » Fri Feb 12, 2016 3:06 am

Sometimes, programming can make you feel very stupid. This is one of those times. Thanks so much!
B
10
S
2
Posts: 20
Reputation: 622