Hello !
Maybe I did not searched with the proper words, but I cannot find a way to check if a string contains some text.
For example I would like an event like this one:
variable1 = "sometext"
if variable1 contains "text" return true.
Is this possible ?
From the manual:
https://www.scirra.com/manual/126/system-expressions
find(src, text)
Find the first index within src that text occurs, else returns -1.
so system compare two values : find(variable1, "text") is not -1
if the variable contains the text this condition will be true...
or........
capx:
http://s000.tinyupload.com/index.php?fi ... 9968479480
Thank you littleStin tha'ts perfect !
I was looking in regex, but this was in fact much simplier.
Korbaach, that's interesting. This is much more complex, but it reveals some interesting tricks, thank you.
Can u upload that again please?
Thanks
jhempstead1234
see the second comment in this post.
Use "System->Compare two values"
first value: Find(text1, text2)
comparison: Not equal to
second value: -1
find works in the latest version of C2?
I did several tests and it seems that everything simply returns -1, whether or not the correct word exists
It should work, you are doing something wrong.
Develop games in your browser. Powerful, performant & highly capable.
Probably. How can I use it the right way.
I have never used this feature.
System compare two values find("Abcdef", "bcd") not equal -1
Thanks, I got it resolved.