# Finding a certain number/letter at position "x"

Get help using Construct 2

### » Wed Jan 16, 2013 3:59 pm

Here is the problem:
I got a text box with 5numbers, how could I for example see the 4th number in this piece of text?

Example:
Text = 57396
Find the 2nd number
I should get the answer 7

I tried mid function, might not be doing it correctly?

If anyone got an idea on how to do this and would like to add a capx I would be grateful!
(\__/)

(='.'=)

(")_(")
B
23
S
10
G
1
Posts: 74
Reputation: 3,244

### » Wed Jan 16, 2013 4:21 pm

'Left' function :)
Moderator
B
72
S
14
G
11
Posts: 900
Reputation: 11,965

### » Wed Jan 16, 2013 4:35 pm

Could you provide some kind of capx()? Might be setting it up wrong.
(\__/)

(='.'=)

(")_(")
B
23
S
10
G
1
Posts: 74
Reputation: 3,244

### » Wed Jan 16, 2013 8:10 pm

Use mid(), the position is zero based so to get the first digit use:
mid(Text.Text, 0, 1)
second:
mid(Text.Text, 1, 1)
third:
mid(Text.Text, 2, 1)
...
B
101
S
39
G
134
Posts: 5,591
Reputation: 85,520

### » Wed Jan 16, 2013 8:58 pm

https://www.scirra.com/manual/126/system-expressions

Some fantastic tools in here. It's always worth reviewing what toolset has to offer. You never know what you will be inspired to create or refine by going through it once and a while.
B
94
S
18
G
9
Posts: 2,457
Reputation: 15,187