Hundreds of features to explore
Games made in Construct
Your questions answered
Trusted by schools and universities worldwide
Free education resources to use in the classroom
Students do not need accounts with us
What we believe
We are in this together
World class complete documentation
Official and community submitted guides
Learn and share with other game developers
Upload and play games from the Construct community
Game development stories & opinions
Is there a way to search for value in array and replace it? I'm guessing I would start with array > contains value, but then how do I replace it?
Example:
Let's say I have an array with dog, cat, bird. Can I find bird and replace it with cow?
Develop games in your browser. Powerful, performant & highly capable.
You can use "IndexOf" expression to retrieve the index of an element. It works only on the X axis though.
replace() or RegexReplace() are your friends... or maybe estranged fourth cousins.
Magistross Do I place the IndexOf in the "Contains value" condition or Compare X? Also, since I am sorting as well and because the list is always changing, I do not know the index number. Does this still apply?
— Do I put replace() and RegexReplace() inside the array Insert?
index of..
capx> http://s000.tinyupload.com/index.php?fi ... 8731980349
You can use it at any place. The main difference between replace() and RegexReplace() is that replace() actually returns a string text for use, while RegexReplace() just overwrites the existing text in the argument.