How do I get number from text?

Get help using Construct 2

Post » Sat Apr 01, 2017 9:48 am

I have a text variable containig numbers. For example (3,9) or (12, 10). If I use text expression left(text, count) it returns the first charecter, and doesn't help to return the number containing two charecters.
What is the best solution to return numbers from the text in the example?
B
20
S
4
Posts: 52
Reputation: 1,106

Post » Sat Apr 01, 2017 9:53 am

You use the token expressions, where the seperator is ",".

So tokenat(text,index,",") and wrap it in int() to convert it from string bacl to value.
B
43
S
23
G
21
Posts: 735
Reputation: 12,142

Post » Sat Apr 01, 2017 11:21 am

Ethan wrote:You use the token expressions, where the seperator is ",".

So tokenat(text,index,",") and wrap it in int() to convert it from string bacl to value.

Thanks, it works!!!
B
20
S
4
Posts: 52
Reputation: 1,106


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 5 guests