Error comparing a number that has been read from a .txt file

Hi !
This is my first post. I hope you can help me:

I have a number saved inside a file called Saldo.txt . I just need to retrieve it, put it inside a Label and then, compare it with a number written by the user in a TextBox. That's it!

Please it would be awesome if you can help me

I have compared the two strings directly using GREATER THAN OPERATOR >
I have used the block trim
I have used the block split (splitting the string at "\n")
I have used the block replace (replacing" \n" by a blank space)
I have created a global variable and set its value to the retrieved number
I have created the global variable and then tried to apply trim , split, and replace

Nothing works! :frowning: !
Here are the blocks


use Do it to debug your blocks, see also tip 4 here
see also Live Development, Testing, and Debugging Tools

Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.
emphasized text


Hi there! Thanks for replay!

I have executed simulation and I get this:

300 is the number inside the .txt file named Saldo.txt

Please help :frowning: I don't know what else to try

Check this again:

Your "Saldo.txt" blik has incorrect encoding. I don't know what you created this file in, but use UTF8 encoding and not UTF8 from the BOM. Except for the number 300, your file contains additional EF BB BF bytes which the app inventor does not recognize and therefore causes a problem.

This project worked:


1 Like

See also here:

1 Like

THANKS A LOT <3 THIS REALLY WORKS ! :star_struck: :star_struck: :heart_eyes:

Can you please tell me: how can I create text files with UTF8 encoding without "BOM" ?
I mean, what software do you use? I'm going to need it later to create other .txt files to read data from the App

I have tried this and works PERFECT TOO!

Thanks a lot for taking time to reply ! :heart_eyes: :smiling_face_with_three_hearts:

Thanks to all of you !

I have never used an online forum. This is my first time, and I'm glad to meet, really kind people like you guys ! @Anke @Taifun @Patryk_F :star_struck: THANKS A LOT!

P.S: I will mark as solution @Patryk_F 's reply, but @Anke 's reply also works perfect !

An ordinary notepad in Windows allows you to create files in several encodings.

1 Like

Thanks a lot !

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.