How do I find the line of a Character/Number in Text?

Get help using Construct 2

Post » Fri Jan 20, 2017 6:30 pm

Hey guys! Can someone help me to find the line of a character or number in text?
I use 2 Text Plugins, 1 Text Box and 1 Button. So, we have:

Text1 (Original):
Code: Select all
This is a test.
Today!
10
Hello C2!!!
100


Code: Select all
TextBox -> I write "Today!"
Button -> Click


Text2 (Result):
Code: Select all
1


To understand more, the lines of text as i think are:
"This is a test." is 0
"Today!" is 1
"10" is 2
"Hello C2!!!" is 3
"100" is 4

What i need to use? A Regex Search? Array? A simple method? Can someone help me? Thanks!
B
52
S
32
G
14
Posts: 242
Reputation: 12,333

Post » Fri Jan 20, 2017 9:59 pm

repeat tockencount(text1, newline) times
system compare: tockenat(text1, loopindex, newline) = textbox.text
--- set text2 to loopindex
--- stop loop
B
92
S
32
G
109
Posts: 5,291
Reputation: 70,993

Post » Fri Jan 20, 2017 10:58 pm

Thank you!!! ; -)
B
52
S
32
G
14
Posts: 242
Reputation: 12,333


Return to How do I....?

Who is online

Users browsing this forum: beohs, tunepunk and 9 guests