I have a string of text: "Today I went to the park_and I saw_a bird"
How would I count how many time an underscore "_" is in the string?
At the moment this is what I have
It does show me how many there are but there's a delay since it takes a while for it to scan through the string. Is there a quicker way to do this? Thank you!
Develop games in your browser. Powerful, performant & highly capable.
Well, you could do: tokencount(String,"_")-1
SparkleNaut Looking at your screenshot - that is a very wrong way to do loops in Construct! If you want to compare each letter one by one, do something like this:
System Repeat len(s) times
System compare two values mid(s, loopindex, 1)="_" -> Add 1 to counter
Note, line #2 is a sub-event under #1.
This whole loop will be done in one tick.