Comparing between 2 text boxes

Hi friends,

I am using app inventor 2. I have a text in textbox1.text and I want to Compare it to another text in Textbox2.text

And highlight the different spelling words in a red color, how could I do this?

You could use html in a Label using HTMLFormat. Sorry, you cannot use html color changes in a TextBox (it has no special html capability). To to see differences, you would need to display two Labels with HTMLFormat checked; one with the contents of Textbox1 and the other with Textbox2 and provide code to indicate which characters should be highlighted. Have you written the routines to determine the differences yet. If so, use them as a guide.

Alternatively you might display your text in a WebViewer. The WebViewer can ready html tags.

See Taifun’s discussion New formatting possibilities with the Label on how to show color changes for individual letters.

Regards,
Steve

Perhaps show example texts of what you are trying to do…

Thanks for your answer. I was asking about comparing code regardless used component. Can you help me with an example to perform this comparison?

I did not write any thing yet, I was aiming to help me with an example.

The IF statement will compare all the text in the first component with all the text in the second component, how to mark the different words between the 2 components?

Really? Your topic indicated 'Comparing between 2 text boxes'. You only can change text color using a few components the way you described. The only practical component is a Label.

Tim requested you 'show example texts of what you are trying to do" ; you did not do that.

What you are attempting requires complex logic. Here is some advice :slight_smile:

The form is here to help others, not to build their Projects . If there is a tutorial or we know of an algorithm to do what a users attempts, we are glad to point you in that direction. For your issue, probably nothing is published so you need to solve the problem, don't you think?

ere are some resources to help you learn to use the AI2 tools. A very good way to learn App Inventor is to read the free Inventor's Manual here in the AI2 free online eBook http://www.appinventor.org/book2 ... the links are at the bottom of the Web page. The book 'teaches' users how to program with AI2 blocks.

There is a free programming course here http://www.appinventor.org/content/CourseInABox/Intro and the aia files for the projects in the book are here: http://www.appinventor.org/bookFiles

How to do a lot of basic things with App Inventor are described here: http://www.appinventor.org/content/howDoYou/eventHandling .

Also look here App inventor español. Offline. Tutorial. Ejemplos. Instalación. Códigos. Juegos. Curso gratis de App inventor. and here Tutorial Index | imagnity for more tutorials.

That is a little vague.
Let's try a sample.
Tell me how many words are different between these two sentences:

  • AI2 is a learning tool.
  • AI2 was meant to be a learning tool

Hint: diff utility