How to detect a list of words within a TextBox

I have a problem, I try to store a list of words that I want to detect within a textbox (avoid rude words and warn them that it cannot be used), the thing is that it does not work correctly for me.

I leave the TextBox empty and I get the message, it only detects the first word in the list but not the others, these are separated by commas “,”.

Words example list: word1, word2, etc.
The list of comma-separated words I am extracting from a tinydbweb.

image

What am I doing wrong?

Hello @losasencio

Since you are working with list consider using is in list block instead of contains block


where your list goes in the list socket and the textbox’s text goes in the thing socket

(Image taken from App Inventor documentation)
2 Likes

It gives me an error of bad arguments.
image

use Do it to debug your blocks
see also tip 4 here App Inventor: How to Learn | Pura Vida Apps

Unbenannt
in case you can’t solve it yourself, then please post a screenshot including Do it results

Taifun

Can you show the exact error? Or if possible do what @Taifun said

Try using for each item in list block and split text_box1.text at spaces.

      for(String s : text){
      for (String b : list){
      if(s == b){
     System.out.println("Delete bad words");
       }
      }
       }