Find units in a text file?

It seems that StrFind doesn’t work anymore in the recent version of Gdevelop. Is there any way to questioning whether a text file contains a specific number or word? And then make it a condition.

Let’s try to fix StrFind instead of reinventing the wheel. :blush:
You need to enter the full text as first argument, and the specific string to search as second argument, likeso:

Very thanks to you, I just could’t find the formula before.

It is done now but a new problem had emerged (as always :slight_smile: ) . I need to find 11 digit numbers in the text file. The text file is a list actually, has lots of 11 digit numbers and if the login text entry is one of them, a person will be able to enter. But, in this condition, any number in the list that is text entered is enough to open the rest of the game. I want a full 11 digit number from the list to open the game. What can I do?

I ve made a very basic solution. Added a new scene variable, “any key pressed>add 1 to buttonpush”, and added “buttonpush>=11” as a new condition to login. But I still wonder if there is a code about number digit.

I’m not sure I understood, but I think what you want is StrFind(TextListObject.String(),VariableString(logintextentry))
And if the result is not -1, success.

Yes, I’ve just done as this after you wrote, thank you. And solved the digit problem as stated. Eg. the list contains “12345678, 87654321” and you just write 1 or 1234, the formula success. I didnt want it and added another condition (buttonpush). Thank you very much again.

1 Like